woprman Posted March 8, 2010 Share Posted March 8, 2010 Hello! My form works great, the only problem is it still works if the textbox is blank. I just need it to either not submit OR make the box say error: enter email. the code: <?php $EmailFrom = "WOP"; $EmailTo = "[email protected]"; $Subject = "Contact Inquiery"; $subscribe = Trim(stripslashes($_POST['subscribe'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "subscribe: "; $Body .= $subscribe; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">"; } ?> Please help! Link to comment https://forums.phpfreaks.com/topic/194462-simple-php-form-req/ Share on other sites More sharing options...
woprman Posted March 8, 2010 Author Share Posted March 8, 2010 require() doesnt work anymore? Link to comment https://forums.phpfreaks.com/topic/194462-simple-php-form-req/#findComment-1022854 Share on other sites More sharing options...
woprman Posted March 8, 2010 Author Share Posted March 8, 2010 got it: $validationOK=true; if ($_POST["subscribe"] == "") { die("Please fill out all fields"); } Link to comment https://forums.phpfreaks.com/topic/194462-simple-php-form-req/#findComment-1022856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.