Jump to content

kenng

New Members
  • Posts

    1
  • Joined

  • Last visited

kenng's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, How do i prevent it from resubmitting? When ever, i go back and submit again. It will have multiple echo out different names. Heres my php. <?php include("connect.php"); if(isset($_GET['process'])) { $emailCheck = mysql_query("SELECT email, mobile FROM user_info WHERE email = '$_POST[email]' OR mobile = '$_POST[mobile]'") or die (mysql_error()); $number = mysql_num_rows($emailCheck); if ($number > 0) { echo "You already registered."; } else { $query = "Insert INTO user_info (lastname, firstname, email, mobile, gender) values('$_POST[lastname]', '$_POST[firstname]','$_POST[email]','$_POST[mobile]', '$_POST[gender]')"; $result = mysql_query($query) or die(mysql_error()); if(!$result) { echo "Opps something went wrong. Please try again. ERROR: ".mysql_error(); } else { $name = $_POST['firstname']; $query = "select * from user_info where firstname = '$name'"; $result = mysql_query($query); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $email = $_POST[email]; $EmailSubject = "You've Just Registered On Health Board"; $mailheader = "From: [email protected]\n"; $mailheader .= "Reply-To: [email protected]\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY .= "Dear " . $line['lastname'] . " " . $line['firstname'] . ",</h1>" . "<br /><br />Thank you for registering with us, I hope you have a good day.<br /><br />Regards,<br /><br />Health Board"; mail($email, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Encounter some error. Please contact [email protected]"); ?> <html> <head> <title>Submitted</title> <meta http-equiv="refresh" content="5;url=index.html" /> <meta HTTP-EQUIV="Pragma" content="no-cache"> <meta HTTP-EQUIV="Expires" content="-1"> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <h1>Thank you, <? echo $line['lastname'] ; echo " "; echo $line['firstname'] ; ?> </h1> Thank you for submitting. <p>In addition, a confirmation copy was sent to your e-mail address.</p> <p>You will be back in 5secs</p> </div> </body> </html> <? } } } } mysql_close($db); ?> Please excuse my coding... still new. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.