lukeawade Posted September 9, 2008 Share Posted September 9, 2008 I have a registration page that if all the required fields are filled out then it submits the information to a database and sends them an email. If one of the reqiured fields arent filled out it shows an error message on the same page. What I'm TRYING to add is a check to see if that email is already in the database or doesnt exist then it shows an error on the same page. WHAT I HAVE WORKING is it checking to see if it exists in the database but it takes you to a blank page with the error message. Please help. My code is below: <?php require_once('../Connections/connRegistration.php'); ?> <?php // Load the common classes require_once('../includes/common/KT_common.php'); // Load the tNG classes require_once('../includes/tng/tNG.inc.php'); // Make a transaction dispatcher instance $tNGs = new tNG_dispatcher("../"); // Make a transaction dispatcher instance $tNGs = new tNG_dispatcher(""); // Make unified connection variable $conn_connRegistration = new KT_connection($connRegistration, $database_connRegistration); // Start trigger $formValidation = new tNG_FormValidation(); $formValidation->addField("first_name", true, "text", "", "", "", ""); $formValidation->addField("last_name", true, "text", "", "", "", ""); $formValidation->addField("company", true, "text", "", "", "", ""); $formValidation->addField("address1", true, "text", "", "", "", ""); $formValidation->addField("city", true, "text", "", "", "", ""); $formValidation->addField("state", true, "text", "", "", "", ""); $formValidation->addField("zip", true, "text", "zip_generic", "", "", ""); $formValidation->addField("phone", true, "text", "phone", "", "", ""); $formValidation->addField("cell_phone", false, "text", "phone", "", "", ""); $formValidation->addField("fax", false, "text", "phone", "", "", ""); $formValidation->addField("email", true, "text", "email", "", "", ""); $formValidation->addField("distribution_method", true, "distribution_method", "", "", "", ""); $tNGs->prepareValidation($formValidation); // End trigger //start Trigger_SendEmail trigger //remove this line if you want to edit the code by hand function Trigger_SendEmail(&$tNG) { $emailObj = new tNG_Email($tNG); $emailObj->setFrom("[email protected]"); $emailObj->setTo("{email}"); $emailObj->setCC(""); $emailObj->setBCC("[email protected]"); $emailObj->setSubject("Project Registration"); //WriteContent method $emailObj->setContent("{first_name}, Thank you for registering. The Project Information Management Team (Preferred Delivery Method: {distribution_method}) "); $emailObj->setEncoding("ISO-8859-1"); $emailObj->setFormat("HTML/Text"); $emailObj->setImportance("Normal"); return $emailObj->Execute(); } //end Trigger_SendEmail trigger if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsMail = "-1"; if (isset($_POST['email'])) { $colname_rsMail = $_POST['email']; } mysql_select_db($database_connRegistration, $connRegistration); $query_rsMail = sprintf("SELECT first_name, email FROM dashboard_registration WHERE email = %s", GetSQLValueString($colname_rsMail, "text")); $rsMail = mysql_query($query_rsMail, $connRegistration) or die(mysql_error()); $row_rsMail = mysql_fetch_assoc($rsMail); $totalRows_rsMail = mysql_num_rows($rsMail); // checks if the email is registered if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $usercheck = $_POST['email']; $check = mysql_query("SELECT email FROM dashboard_registration WHERE email = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { die('Sorry, the email '.$_POST['email'].' has already registered.'); } // Make an insert transaction instance $ins_dashboard_registration = new tNG_insert($conn_connRegistration); $tNGs->addTransaction($ins_dashboard_registration); // Register triggers $ins_dashboard_registration->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1"); $ins_dashboard_registration->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation); $ins_dashboard_registration->registerTrigger("END", "Trigger_Default_Redirect", 99, "thankyou.html"); $ins_dashboard_registration->registerTrigger("AFTER", "Trigger_SendEmail", 98); // Add columns $ins_dashboard_registration->setTable("dashboard_registration"); $ins_dashboard_registration->addColumn("first_name", "STRING_TYPE", "POST", "first_name"); $ins_dashboard_registration->addColumn("last_name", "STRING_TYPE", "POST", "last_name"); $ins_dashboard_registration->addColumn("company", "STRING_TYPE", "POST", "company"); $ins_dashboard_registration->addColumn("address1", "STRING_TYPE", "POST", "address1"); $ins_dashboard_registration->addColumn("address2", "STRING_TYPE", "POST", "address2"); $ins_dashboard_registration->addColumn("city", "STRING_TYPE", "POST", "city"); $ins_dashboard_registration->addColumn("state", "STRING_TYPE", "POST", "state"); $ins_dashboard_registration->addColumn("zip", "STRING_TYPE", "POST", "zip"); $ins_dashboard_registration->addColumn("phone", "STRING_TYPE", "POST", "phone"); $ins_dashboard_registration->addColumn("cell_phone", "STRING_TYPE", "POST", "cell_phone"); $ins_dashboard_registration->addColumn("fax", "STRING_TYPE", "POST", "fax"); $ins_dashboard_registration->addColumn("email", "STRING_TYPE", "POST", "email"); $ins_dashboard_registration->addColumn("registration_date", "DATE_TYPE", "POST", "registration_date"); $ins_dashboard_registration->addColumn("ip", "STRING_TYPE", "POST", "ip"); $ins_dashboard_registration->setPrimaryKey("reg_id", "NUMERIC_TYPE"); $ins_dashboard_registration->addColumn("distribution_method", "STRING_TYPE", "POST", "distribution_method"); $ins_dashboard_registration->addColumn("proj_id", "INT_TYPE", "POST", "proj_id"); // Execute all the registered transactions $tNGs->executeTransactions(); // Get the transaction recordset $rsdashboard_registration = $tNGs->getRecordset("dashboard_registration"); $row_rsdashboard_registration = mysql_fetch_assoc($rsdashboard_registration); $totalRows_rsdashboard_registration = mysql_num_rows($rsdashboard_registration); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Project Dashboard Registration</title> <link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /> <script src="../includes/common/js/base.js" type="text/javascript"></script> <script src="../includes/common/js/utility.js" type="text/javascript"></script> <script src="../includes/skins/style.js" type="text/javascript"></script> <?php echo $tNGs->displayValidationRules();?> <style type="text/css"> <!-- .style1 {font-size: 9px} .style2 { font-family: Arial, Helvetica, sans-serif; font-size: 16px; color: #333333; } .norepeatbg { background:url(images/table_bottom.gif); background-repeat: no-repeat; background-position:bottom; } .style22 { font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight:bold; color: #FF0000; } .style3 { font-family: Arial, Helvetica, sans-serif; font-size: 36px; font-weight: bold; color: #333333; } .style4 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #666666; } .style24 {color: #FF9900} .style25 {color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 18px;} .style26 { font-size: 12px; font-style: italic; color: #666666; } --> </style> </head> <body> <table width="525" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> <tr> <td><img src="/jedunn/images/table_top.gif" alt="Table Top" width="525" height="14" /></td> </tr> <tr> <td background="/jedunn/images/table_middle.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td><div align="center" class="style3">Download </div></td> </tr> <tr> <td class="style2"><div align="center" class="style25"> </div></td> </tr> <tr> <td> </td> </tr> <tr> <td><table width="409" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="style4"><div align="justify">Please fill out the form below to download the software installer. provides you access to the very latest project information, including:</div></td> </tr> <tr> <td class="style4"> </td> </tr> <tr> <td class="style4"> </td> </tr> <tr> <td class="style4"> </td> </tr> <tr> <td class="style4"><div align="justify">If you have any questions, please feel free to contact the technical support department.</div></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> </table></td> </tr> <tr> <td valign="top" background="../Copy of jedunn/images/table_middle.gif"><table width="525" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="420" valign="top" class="norepeatbg"> <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>"> <div align="center"> <table width="402" align="center" cellpadding="2" cellspacing="0" > <tr> <td valign="top" class="style22"> </td> <td valign="top" class="style2"><div align="left"></div></td> <td height="30" valign="top" class="style22"><div align="left"></div></td> </tr> <tr> <td valign="top" class="style22"> </td> <td colspan="2" valign="top" class="style2"><strong>Contact Information:</strong></td> </tr> <tr> <td valign="top" class="style22"> </td> <td valign="top" class="style2"> </td> <td valign="top" class="style22"> </td> </tr> <tr> <td valign="top" class="style22">*</td> <td valign="top" class="style2"><label for="first_name"> <div align="left">First Name:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="first_name" type="text" id="first_name" value="<?php echo $row_rsdashboard_registration['first_name']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "first_name"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="last_name"> <div align="left">Last Name:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="last_name" type="text" id="last_name" value="<?php echo $row_rsdashboard_registration['last_name']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "last_name"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="company"> <div align="left">Company:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="company" type="text" id="company" value="<?php echo $row_rsdashboard_registration['company']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "company"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="address1"> <div align="left">Address:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="address1" type="text" id="address1" value="<?php echo $row_rsdashboard_registration['address1']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "address1"); ?></div></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" ><label for="address2"> <div align="left">Bldg/Suite:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="address2" type="text" id="address2" value="<?php echo $row_rsdashboard_registration['address2']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "address2"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="city"> <div align="left">City:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="city" type="text" id="city" value="<?php echo $row_rsdashboard_registration['city']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "city"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><div align="left">State:</div></td> <td valign="top" class="style22"><div align="left"> <select name="state" id="state"> <option selected="selected" value="<?php echo $row_rsdashboard_registration['state']; ?>"><?php echo $row_rsdashboard_registration['state']; ?></option> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="DC">DC</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> <?php echo $tNGs->displayFieldError("dashboard_registration", "state"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="zip"> <div align="left">Zip:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="zip" type="text" id="zip" value="<?php echo $row_rsdashboard_registration['zip']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "zip"); ?></div></td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="phone"> <div align="left">Office Phone:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="phone" type="text" id="phone" value="<?php echo $row_rsdashboard_registration['phone']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "phone"); ?></div></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" ><div align="left">Mobile Phone:</div></td> <td valign="top" class="style22"><div align="left"><input name="cell_phone" type="text" id="cell_phone" value="<?php echo $row_rsdashboard_registration['cell_phone']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "cell_phone"); ?></div></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" ><label for="fax"> <div align="left">Fax:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="fax" type="text" id="fax" value="<?php echo $row_rsdashboard_registration['fax']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "fax"); ?></div></td> </tr> <tr> <td height="49" valign="top" class="style22" >*</td> <td valign="top" class="style2" ><label for="email"> <div align="left">E-mail:</div> </label></td> <td valign="top" class="style22"><div align="left"> <input name="email" type="text" id="email" value="<?php echo $row_rsdashboard_registration['email']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "email"); ?> </div></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" > </td> <td valign="top" class="style22"> </td> </tr> <tr> <td colspan="3" valign="top" class="style22" ><table width="337" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><div align="justify"><span class="style26">Please choose a delivery method below. Installation CD's will be shipped ground the day your registration is received.</span></div></td> </tr> </table></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" > </td> <td valign="top" class="style22"> </td> </tr> <tr> <td valign="top" class="style22" >*</td> <td valign="top" class="style2" ><div align="left">Delivery Method:</div></td> <td valign="top" class="style22"><div align="left"> <select name="distribution_method" id="distribution_method"> <option selected="selected" value="<?php echo $row_rsdashboard_registration['distribution_method']; ?>"><?php echo $row_rsdashboard_registration['distribution_method']; ?></option> <option value="CD">Install CD</option> <option value="Download">Electronic Download</option> </select> <?php echo $tNGs->displayFieldError("dashboard_registration", "distribution_method"); ?></div></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" > </td> <td valign="top" class="style22"> </td> </tr> <tr> <td colspan="3" valign="top" class="style22" ><table width="337" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><div align="justify"><span class="style26">Estimated Download Times:</span></div></td> </tr> <tr> <td> <p align="left">T1/Business Class: 20 minutes Cable/DSL: 50 minutes Dialup: 15 hours </p> </td> </tr> </table></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" > </td> <td valign="top" class="style22"> </td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" ><div align="left"></div></td> <td valign="top" class="style22"><div align="left"> <input type="submit" name="KT_Insert1" id="KT_Insert1" value="Submit" /> </div></td> </tr> <tr> <td valign="top" class="style22" > </td> <td valign="top" class="style2" > </td> <td valign="top" class="style22"> </td> </tr> </table> </div> <input type="hidden" name="proj_id" id="proj_id" value="23" /> <input type="hidden" name="registration_date" id="registration_date" /> <input type="hidden" name="ip" id="ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" /> </form> </td> </tr> </table> </td> </tr> <tr> <td height="35" valign="bottom"><table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="style1">Powered by: </td> </tr> <tr> <td class="style1"> </td> </tr> </table></td> </tr> </table> </body> </html> <?php mysql_free_result($rsMail); ?> Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/ Share on other sites More sharing options...
tmallen Posted September 9, 2008 Share Posted September 9, 2008 Please, please wrap your code in BBCode "code" tags so that it prints as code and syntax highlights. I can't fight through this. Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637753 Share on other sites More sharing options...
Stooney Posted September 9, 2008 Share Posted September 9, 2008 along with using code tags, try to only post the problem area, not all the code you've ever written. Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637775 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 Yeah probably didn't need to see the entire code... but here is code that checks if an email exists in case a user forgets his password it is mailed to them. <?php include('dbconnect.php'); $tbl_name="users"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // the values sent from form $email=$_POST['email']; $myusername=$_POST['myusername']; //run query to get password with users inputed info $emailexists = mysql_query("SELECT * FROM `users` WHERE `users`.`email` = '$email'") or die(mysql_error()); $getpassword = mysql_query("SELECT `users`.`password` FROM `users` WHERE `users`.`email` = '$email'") or die(mysql_error()); //verify email is actually valid $email = trim($email); $_name = "/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+"; $_host = "([-0-9A-Z]+\.)+"; $_tlds = "([0-9A-Z]){2,4}$/i"; //set up mail message $result = mysql_fetch_assoc($getpassword); $message = "Hello, ".$myusername.". Your Password is: ".$result['password']; //gets the password from the array and displays it if(preg_match($_name."@".$_host.$_tlds,$email)){ //verify email is actually valid if(!empty($emailexists)){ if (!empty($myusername) || !empty($email) ) { //if it passes all the checks and balances lol $email=$_POST['email']; mail($email, "Here is your password", $message , "From: [email protected]"); //Send email to them with variables already set up echo "Your password has been sent to your email address, you will be redirected momentarily."; echo '<meta content="3; URL=index.php" http-equiv="Refresh" />';// takes you temporarily to another blank page tells the user the password has been sent and then back to index.php }//end filled out form check else { echo "You did not fill on all required fields."; echo '<meta content="3; URL=forgotpassword.php" http-equiv="Refresh" />';// takes you temporarily to another blank page tells the user they didnt fill in all the fields and then back to forgotpassword.php } }//end email exists check else { echo "Sorry, your email address was not found in our database."; echo '<meta content="3; URL=forgotpassword.php" http-equiv="Refresh" />';// email not found and then back to forgotpassword.php } }//end proper email validation else { echo "This email address is not in the correct format."; echo '<meta content="3; URL=forgotpassword.php" http-equiv="Refresh" />';// incorrect email format msg and then back to forgotpassword.php } ?> Hope this helps Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637778 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 Not all the code you've ever written. Hahahhahahahahahahaha oh man... my co-workers just looked at me like wt eff hahha Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637779 Share on other sites More sharing options...
lukeawade Posted September 9, 2008 Author Share Posted September 9, 2008 whats the BBC code tags Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637810 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 when you go to start a new discussion on the top of the page you will see a lot of little icons (dont worry they yelled at me at first too when i first started posting) and if you press the one with the # it will give you this little <?php is so cool ?> just put your code in between there and it'll look all pretty then did what i post help? Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637821 Share on other sites More sharing options...
lukeawade Posted September 9, 2008 Author Share Posted September 9, 2008 Kind of. Im just checking to see if the email exists in this list I have in my database and that actually works. I just cant get it to display under my email box. Currently if they dont put an email and click submit then it shows an error. The code below is what I use to check if their email has already been put in the database. Only problem is if their email already exists it takes me to a blank page and just says my error message. "'ERROR! The email '.$_POST['email'].' has already registered." I want it to display this message below my email text field. <?php //my email check above the body & head //checks if the email is registered if (!get_magic_quotes_gpc()) {$_POST['email'] = addslashes($_POST['email']);} $usercheck = $_POST['email']; $check = mysql_query("SELECT email FROM dashboard_registration WHERE email = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) {die ('ERROR! The email '.$_POST['email'].' has already registered.');} //my text field in a table in the body <input name="email" type="text" id="email" value="<?php echo $row_rsdashboard_registration['email']; ?>" size="32" /> <?php echo $tNGs->displayFieldError("dashboard_registration", "email"); ?> Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637837 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 Here try this instead of die... and change the index.php page to wherever you want it to redirect to after you show them the error. you can change the 3 to less (3 is the time it spends before redirecting) //if the name exists it gives an error if ($check2 != 0) { echo "Sorry, your email address has already been registered."; echo '<meta content="3; URL=index.php" http-equiv="Refresh" />';// where index.php is the page you want it to go back to after you show the email } Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637855 Share on other sites More sharing options...
lukeawade Posted September 9, 2008 Author Share Posted September 9, 2008 echo doesnt work. I have my page redirecting to a thank for registering page and echo doesnt work for some reason. I put in an email that is already in the database and it just redirects me to the next page with no error Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637879 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 hmm... are you having the form post to itself? if so you could try and change the form's action to action="checkemail.php" and have all of your checks and code within the checkemail.php and then echo would work and you could redirect them back to the registration page with the echo '<meta... Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637889 Share on other sites More sharing options...
lukeawade Posted September 9, 2008 Author Share Posted September 9, 2008 currently I have a trigger sending it to the next page. <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>"> Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637893 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 Does your page have a black background? echo '<font color="red">"Sorry this email address is already registered."</font>'; Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637905 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 If this doesn't work, my next suggestion is to start a new topic with a more focused question and only a segment of code and get some of the experts to take a look at it. Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637908 Share on other sites More sharing options...
lukeawade Posted September 9, 2008 Author Share Posted September 9, 2008 no my page doesnt have a black background and it wouldnt matter if it did because it redirects to another page. How do i get experts to look at it? Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637912 Share on other sites More sharing options...
thesaleboat Posted September 9, 2008 Share Posted September 9, 2008 start a new topic with only a section of code so they will actually look at it... sorry i couldn't help man ??? :-\ best of luck im out for the day Link to comment https://forums.phpfreaks.com/topic/123482-registration-page-email-exists/#findComment-637916 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.