Error in if
condition. I am trying to generate 5digit random no, and verify that random no and textbox values ($_POST['otp1'])
equal move to thank.php
page else show popup error.
I did everything, if textbox values and $otp
value is equal it showing popup message.
Following is the code
otp.php
<form action="otp.php" method="post">
<label>Mobile :</label>
<input type="text" name="mobile" /> <br /><br />
<label>OTP :</label>
<input type="text" name="otp1" /> <br /><br />
<input type="submit" name="send" value="Verifiy" />
</form>
<?php
$otp = intval( "0" . rand(1,9) . rand(0,9) . rand(0,9) . rand(0,9) . rand(0,9) );
echo $otp;
if(isset($_POST['send']))
{
$mobile = $_POST['mobile'];
$otp_no = $_POST['otp1'];
if($otp_no != $otp) \\ Condition not work
{
echo "<script>alert('Your OTP is Worng'); window.location.replace(\"otp.php\");</script>";
}
else
{
header('Location: thank.php');
}
}
?>
Aucun commentaire:
Enregistrer un commentaire