PHP, If/Else statement shows condition even if I have not provided inputs yet -


i have form supposed enter number when run code displays event of first condition if had not yet typed number.

<form action="" method="post"> <table> <tr> <td>first number:</td><td><input type="text" name="numberone"></td> <tr> <tr> <td><input type="submit" value="submit" /></td> </tr> </table> </form>  <?php @$one = $_post['numberone']; @$two = $_post['numbertwo'];   if ($one<"10") { echo "have morning!"; } else if ($one<"20") { echo "have day!"; }  ?> 

check if form has been submitted:

if(isset($_post['numberone']) && isset($_post['numbertwo'])){      $one = (int)$_post['numberone'];     $two = (int)$_post['numbertwo'];      if($one < 10){       echo "have morning!";      }elseif($one < 20){       echo "have day!";     }  } 

don't suppress errors @, because won't see notices, in case have helped spot problem :)


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -