ilikephp Posted January 25, 2011 Share Posted January 25, 2011 Hi, I have a form, it is working fine and it validates using spry... When the user clicks the submit button and all the fields are filled, he will be redirected to the homepage page if not the required fields will be highlighted, I want to add a message next to the submit button or a popup that displays: "Plz check the errors" this is the code, I think I should add an echo somewhere ?! if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf( GetSQLValueString($_POST['IP'], "text")); . . . mysql_select_db($database_myform, $myform); $Result1 = mysql_query($insertSQL, $myform) or die(mysql_error()); if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header('Location: homepage.php'); } ?> Quote Link to comment Share on other sites More sharing options...
Simon Mayer Posted January 25, 2011 Share Posted January 25, 2011 It's not possible to see where you need to echo, as we cannot see the bit of the page that contains your submit button. It would be easiest to explain if you can provide your full code (including HTML) for the page. Quote Link to comment Share on other sites More sharing options...
ilikephp Posted January 25, 2011 Author Share Posted January 25, 2011 The form is too big, I just need to echo 'Fix your Errors please anywhere, could be next to the submit button' is this one correct? <?php if($_POST['form1'] == 0){ echo 'Check your errors'; } ?> Quote Link to comment Share on other sites More sharing options...
blew Posted January 25, 2011 Share Posted January 25, 2011 you need to validate your form first, like: $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL); then, in the end of the form, you shall put the echo error Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.