When posting PHP code, please use the board's [noparse]
..
[/noparse] bbcode tags as they make your code much easier to read and analyze.
Your problem is here:
$MBFMS=rand(10000,99999);
$MBFverify = $_POST["MrandS"];
The displaying of the form and the processing of it are two separate pageloads, meaning that PHP is going to generate two random numbers since you never store the first generated number for later comparison.
Some ways to store that number might be to use a session or a cookie.