Please have a look at the following info:
1. When both choices are given, we generally use whether (more common in formal writing) rather than if (more common in informal writing):
I don't know whether she's coming or not. (It would be possible to use if here, but less common.)
2. Whether, (but not "IF"), is used before –to infinitives:
I don't know whether to accept their offer or not. (If would not be used here.)
3. After a preposition, only whether is possible:
It's a question of whether we can agree on everything. (If would not be used here.)
4. Both whether and if can be used in indirect speech to introduce a yes/no question:
Did they say whether/if they were going to be late?
5. After some verbs, we use whether:
I doubt whether they'll make it.
We discussed whether it was the correct decision.
However, "what if" is something totally different than the above, we normally use what if for suggestions; note that the main verb can be present or past, a past form makes the suggestion sound less definite.
What if I CAME tomorrow instead of this afternoon?
Hope that this helps and let me know if you need any further info.