thomas_1968 Posted March 2, 2008 Share Posted March 2, 2008 php code for: if the field is empty, it wont proceed to another page.. for example: in registration form, i forgot to fill up one of the required fields. create a code that would not allow a blank fields to save in the database Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/ Share on other sites More sharing options...
trq Posted March 2, 2008 Share Posted March 2, 2008 Is that a question? Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-481475 Share on other sites More sharing options...
ryeman98 Posted March 2, 2008 Share Posted March 2, 2008 http://www.w3schools.com/php/default.asp I'd suggest that you thoroughly read through that before you continue. Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-481476 Share on other sites More sharing options...
blueman378 Posted March 2, 2008 Share Posted March 2, 2008 $var = $_POST["name"]; $compareable = "hello"; if (isset($var) && $var == $comparable) { header('Location: http://www.example.com/secretpage'.php); } something like that? Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-481480 Share on other sites More sharing options...
ryeman98 Posted March 2, 2008 Share Posted March 2, 2008 $var = $_POST["name"]; $compareable = "hello"; if (isset($var) && $var == $comparable) { header('Location: http://www.example.com/secretpage'.php); } something like that? Why make it look complicated? if ($var == $comparable) { header('Location: http://www.example.com/secretpage.php'); } Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-481483 Share on other sites More sharing options...
blueman378 Posted March 3, 2008 Share Posted March 3, 2008 because im not sure if he wants to check if it is equal to that or if it is jsut set so he can just take what he wants Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-482139 Share on other sites More sharing options...
MasterACE14 Posted March 3, 2008 Share Posted March 3, 2008 could you please tell us what it is you are trying to do?? We can't help if we have near to nothing to go on by. Regards ACE Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-482183 Share on other sites More sharing options...
Lamez Posted March 3, 2008 Share Posted March 3, 2008 can't you do something like this: <?php $name = $_POST['name']; if (empty($name)){ //do somthing, the field is empty }else{ //the field is not empty, do somthing } ?> Link to comment https://forums.phpfreaks.com/topic/93974-php-code-for-if-statement/#findComment-482202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.