Jump to content
Larry Ullman's Book Forums

Recommended Posts

	// Check for a password and match against the confirmed password:
	if (strlen($trimmed['password1']) >= 10) {
		if ($trimmed['password1'] == $trimmed['password2']) {
			$p = password_hash($trimmed['password1'], PASSWORD_DEFAULT);
		} else {
			echo '<p class="error">Your password did not match the confirmed password!</p>';
		}
	} else {
		echo '<p class="error">Please enter a valid password!</p>';
	}

Share this post


Link to post
Share on other sites

Sorry on my computer I don't seem to see my actual message, just the code. I get an "undefined index" error when I use this code on the first line - 'password1'.

Thanks.

 

Marie

Share this post


Link to post
Share on other sites
        <p><label for="password"><strong>Password</strong></label>
        <?php create_form_input('password1', 'password', $reg_errors); ?></p>
        <?php if (isset($trimmed['password1'])) echo $trimmed['password1']; ?></p>
       	<p class="noticeType"> Must be between 6 and 20 characters long, with at least one lowercase letter, 
        one uppercase letter, and one number.</p>

 

Share this post


Link to post
Share on other sites

I have reworked this page and code several times since posting and believe I have been able to correct that problem. I changed an area that said pass1 to password.

NOW I am wondering how to format the error messages so that they are in the body of the form like they were in the eCommerce scripts OR how to format them so that they look good rather than just spreading across the top of the page. Can one use CSS in the PHP script?

 

Share this post


Link to post
Share on other sites

You can only apply CSS to HTML but you can create or reference CSS from a PHP script, yes. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×