I have a registration form on my site which looks and works great with hints on some of the fields when clicked in - http://tinyurl.com/7qh263p
On displaying the form, it looks absolutely fine and when submitted correctly, the thank you message is also fine, but if a duplicate email address is entered and the error message displays, it cannot be read because my white background does not show and it is as if the script has just stopped loading, there is no footer, only header and black text with the error.
It is this bit that generates the error:
Code:
//Select was OK - did it return anything?
$rows = mysql_num_rows( $result );
// if a row was found, the email has already been used.
if ($rows > 0) {
die("You have already registered with that e-mail address. Please click back on your browser to go back and try again.");
// *****should Redisplay the page with error.....
}
How do I get the rest of my page to load so that the error can be read.
Using die() will halt the execution of the script. Nothing beyond that will be processed. Instead of using die() you could just store the error in a variable and echo it in your error box or where ever.
PHP Code:
<?php if ($rows > 0) { $error_message = "You have already registered with that e-mail address. Please click back on your browser to go back and try again."; } ?>
<!-- later down in your HTML --> <div id="errorMessage"><?=$error_message?></div>
Bookmarks