View Full Version : "Not sure what the problem is!!!!"

06-23-2009, 09:11 PM
I'm creating a new account script.
At the moment I have 5 'action blocks'.
Following the action blocks I have a
piece of script which adds the new person
to a database.
Everything works until I get to block three.
This checks to see if two entered emails
are the not the same. Oddly, the script does it's
job. When the emails are different an echo warning
operates from within the script for the login page
which holds the form - that's good. Also, when I make
the emails the same the warning doesn't appear
-that's also good. However, for some reason, even
though the email addresses are the same, the program
doesn't proceed to the section where the new person
enters the database it just does nothing. Why won't
it step forward to the 'add to database' section ?
Here's the troublesome script:


foreach($_POST as $field => $value)

if("$email_address" !== "$confirm_email_address")

$point_out = "Emails don't match:";



Here's where it should go next (but it won't !):

if(isset($_POST['email_address']) AND isset($_POST
['confirm_email_address']) AND isset($_POST['password']))
$query = sprintf("INSERT into visitor_login_details (visitor_email, visitor_password) values('$email_address', '$password')");

mysqli_query($cxn,$query) or die (mysqli_error($cxn));

header("location: newvisitorsecond.php");

PS Everything between these two sections is commented out.

I'd be grateful for a solution.


PPS I always enter a dummy password because up to this point in the script nothing is checking the expression of the password - it takes anything.

07-11-2009, 10:33 PM
Not too sure as not all the code is there. If I understand what your doing correctly, I would get rid of the foreach and simply post the form variables to php variables. Then just compare the first and second email variables. As for the IF statement simply putting the following should be enough to test if the variables contain data, IE.. they are set:

if($email && $emailConfirm)
// Variables contain data

You could also remove exit() as it may be exiting the entire script. If I want to test an IF statement I simple comment everything inside and echo a message. That way you know if it has begun executing.

07-12-2009, 11:53 PM
Thanks - you are right, I found this out on a google search.
Thanks again.