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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...