Marie Posted October 7, 2018 Share Posted October 7, 2018 // 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>'; } Link to comment Share on other sites More sharing options...
Marie Posted October 7, 2018 Author Share Posted October 7, 2018 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 Link to comment Share on other sites More sharing options...
Larry Posted October 7, 2018 Share Posted October 7, 2018 What's your HTML form look like? Does it have a `password1` form element? Link to comment Share on other sites More sharing options...
Marie Posted October 8, 2018 Author Share Posted October 8, 2018 <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> Link to comment Share on other sites More sharing options...
Marie Posted October 10, 2018 Author Share Posted October 10, 2018 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? Link to comment Share on other sites More sharing options...
Larry Posted October 10, 2018 Share Posted October 10, 2018 You can only apply CSS to HTML but you can create or reference CSS from a PHP script, yes. Link to comment Share on other sites More sharing options...
Recommended Posts