erme Posted February 11, 2010 Share Posted February 11, 2010 This is a fork off my old post as its now a different problem. I have the below code for a email form that checks what a user enters in the input $Name against a database field 'dbName'. Works fine. I am struggling with the confirm submit button (as commented in the code) to send the email once the user confirms they are not already in the database... struggling is an understatement .. I'm pulling my hair out! <?PHP require_once ("includes/DB_CONNECT.php"); connectSQL(); // Establish SQL connection. if (isset($_POST['submit'])) { $Name = trim(stripslashes($_POST['Name'])); $clientTo="[email protected]"; $message_enq=""; $message_enq.="Name: $Name \n"; $query = "SELECT dbName FROM Tablename WHERE dbName='{$_POST['Name']}'"; $resource = mysql_query($query); if (empty($Name)) { print "<p>Nothing has been entered!</p>"; } else { if (mysql_num_rows($resource) == 0){ mail($clientTo, $subject, $message.$message_enq.$messagefooter, $emailheaders); print "<p>Thank you. Email sent!</p>"; exit; } else { print "Are you sure you are not already listed?<br /><br />"; echo "<button type=\"submit\" name=\"submits\" id=\"submits\">No I'm Not Listed. Add Me</button>"; // I NOW WANT TO SEND THE EMAIL OFF IF THE USER CLICKS THE CONFIRM (SECOND) BUTTON exit; } } } ?> <form id="contactBox" method="post" action="phpform.php"> <input type="text" id="Name" name="Name" value="<?=$Name;?>" /><br /> <button type="submit" name="submit" id="submit">Add Me</button> </form> Thanks everyone Link to comment https://forums.phpfreaks.com/topic/191762-second-submit-confirmation-on-contact-form/ Share on other sites More sharing options...
Deoctor Posted February 11, 2010 Share Posted February 11, 2010 u can do like write a form there and on click of submit button include one more php file by passing the values to that one... u can pass values to other php as file.php?user=$user and likewise... at the other file u can use the _GET fucntion to get these values and then redirect to the phpform.php file after successfull completion of sending mail.. Link to comment https://forums.phpfreaks.com/topic/191762-second-submit-confirmation-on-contact-form/#findComment-1010728 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.