Jump to content

Checking entries


user4fun

Recommended Posts

Problems1- When $entry is higher that $min_entry it still give me the bid_error page.2- $t1, $t2, and $t3 accepts letters, I need it to accept number 0 to 9 only.Thank you

<?$name = $_REQUEST['name'];$t1 = $_REQUEST['t1'];$t2 = $_REQUEST['t2'];$t3 = $_REQUEST['t3'];$entry = $_REQUEST['bid'];$min_entry = "5000";if ($name == ""){  header("Location: name_error.php");  exit();}if (strlen($t1) != 3 || intval($t1) != $t1){  header("Location: ac_error.php");  exit();}if (strlen($t2) != 3 || intval($t2) != $t2 || strlen($t3) != 4 || intval($t3) != $t3){  header("Location: number_error.php");  exit();}if ($entry < $min_entry || !preg_match('^\d+$', $entry)) {  header("Location: bid_error.php");  exit();}else{  echo "good";}?>

Link to comment
Share on other sites

1- When $entry is higher that $min_entry it still give me the bid_error page.
You're comparing them as strings, you should compare them as numbers. Use intval or floatval to convert the value from the form, and remove the quotes around the min entry.You can use this function to test if a variable is a numeric string:http://www.php.net/manual/en/function.is-numeric.php
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...