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'); } ?> Link to comment https://forums.phpfreaks.com/topic/225656-echo-on-submit/ 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. Link to comment https://forums.phpfreaks.com/topic/225656-echo-on-submit/#findComment-1165133 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'; } ?> Link to comment https://forums.phpfreaks.com/topic/225656-echo-on-submit/#findComment-1165135 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 Link to comment https://forums.phpfreaks.com/topic/225656-echo-on-submit/#findComment-1165138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.