Jump to content

Recommended Posts

I really don't remember erasing that :S

 

Anyhow it works now all the way to:

	if( !empty($_POST['password2']) ) { // same validations as in name, above.
	if($_POST['password2'] != $_POST['password'])  {
		$error = 'Passwords do not match.' . 
		$errors[] = $error;
	}
} else {
	$errors[] = 'Confirm your password.';
}

Script always jumps to this error "Confirm your password." even if:

    [password] => abc
    [pass_conf] => abc 

Fixed that...it was a type mistake...now the final thing...

I tried to add [action=do_reg.php] inside form brackets but it wont work..it just jumps over whole script to do_reg.php...so how should i continue the registration after the checking fields...should i add [include 'do_reg.php';] at the end of the php before }?

No. Anything within that conditional will only be executed if the form is submitted with errors, or the form is not submitted. Assuming you want the do_reg script to run when the script has been submitted, and there are NO errors, you would need to add an else{} to go with the if( !empty(errors) ) { conditional.

 

if( !empty($errors) ) {  // if the $errors array is not empty, display the errors to allow the user to correct them and resubmit the form
	echo "<font color=\"red\">The following errors were detected:<br>";
	echo implode("<br>\n", $errors);
	echo '</font>';
} else {
// Code here would be executed if the form has been submitted with no errors.
}

It works almost perfectly but it shows error at:

			$errors[] = $error;

Output:

 

For the code back in reply 25, it looks like you have an error:

 

<?php
...

$error = 'Passwords do not match.' .
$errors[] = $error;

...
?>

 

 

There should be a semi-colon after the line that assigns the value to $error instead of a period. If that's doesn't fix the issue, it might be helpful to post the most recent code.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.