Jump to content
Larry Ullman's Book Forums

Marie

Members
  • Posts

    148
  • Joined

  • Last visited

Everything posted by Marie

  1. I actually was using the values but an interesting thing was happening that I didn't notice before HOWEVER it is still not working properly. Just to recap a bit - I have been working on this site for several months and not realizing until I was trying to integrate the PalPal that my site was letting in registrants that have an expiry date of yesterday in the database. So all along, I have been logging and and they have been accepted. What I had also been doing was giving everyone the same password to make things easier. The way this site is set up EVERYONE can have the same password but one has to have a different email address. SO when I was just testing I was copying and pasting the SQL query but just changing the email address in the query. Now comes another problem. I was looking at the database and noticed that in the rows that contain the registrants where I had gone in and manually changed the expiry date, the phpAdmin was changing the password. It appears like it was chopping some of it off at the end. I didn't notice this. SO when I was logging in with these registrants they were being rejected because the password and email didn't match - as it should. So I went in and made sure that all the registrants had an email and password that matched and I changed all passwords to something different. I left the expiry dates alone. Now my site is accepting everyone - people with ex expire date and those with a date in the future. When I clicked on the "explain SQL" I received a lot of Nulls plus the following - "Impossible WHERE noticed after reading const table . . . " So at this point there are further concerns, one being if PayPal is integrated and the date is updated or changed will that also change the users password. As I mentioned before, one cannot do a lot of testing when it is live – at least not with the same credit card, since they block you. Also I tried putting quotes around the word type and that didn't seem to make a difference. Thanks, Marie
  2. Any help is appreciated. When I echo out row 3 with the expired users, I get a 0 but the user is allowed into the site. When the user has a expiry in the future, nothing gets echoed out and I get the usual message that says the user name and password is not on file. So, I would agree that my SQL query if off but it is exactly what is in the book or so it appears. I am certainly willing to try something else but I really don't see what I am missing from the codes that are in the book. I also went into the phpMyAdmin and was getting similar results - SELECT id, username, TYPE , IF( date_expires >= NOW( ) , true, false ) FROM users WHERE ( email = '$e' AND pass = '" . get_password_hash($p) . "' ) LIMIT 0 , 30 Marie
  3. The site is not letting anyone in when I input a bad email or password, which of course, should happen. I just did a bit more testing and it still is not letting in anyone with an expiry date in the future, such as 2015-01-20 18:47:44. It is still letting in registrants who have the expiry date that is in the past – 2013-01-17 19:43:05. Thanks Marie
  4. I have been testing and trying several different ways of inserting the information into the database, etc. I have compared my code to that in the book and it is almost exactly the same and when changing anything back to the original code I still receive the same result. The login process is allowing a person with an expired date to enter the website. I did notice on page 92, the following line does not have an = sign after the > which shouldn't make any difference to the outcome of result in the example. On page 93 the equals sign is included. $q = "SELECT id, username, type, IF(date_expires > NOW(), true, false) FROM users WHERE (email='$e' AND pass='" . The following code is from the book = $q = "SELECT id, username, type, IF(date_expires >= NOW(), true, false) FROM users WHERE (email='$e' AND pass='" . get_password_hash($p) . "')"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // A match was made. // Get the data: $row = mysqli_fetch_array ($r, MYSQLI_NUM); // If the user is an administrator, create a new session ID to be safe: // This code is created at the end of Chapter 4: if ($row[2] == 'admin') { session_regenerate_id(true); $_SESSION['user_admin'] = true; } // Store the data in a session: $_SESSION['user_id'] = $row[0]; $_SESSION['username'] = $row[1]; // Only indicate if the user's account is not expired: if ($row[3] == 1) $_SESSION['user_not_expired'] = true; } else { // No match was made. $login_errors['login'] = 'The email address and password do not match those on file.'; } } // End of $login_errors IF. I understand what is going on there and have echoed out certain results after changing things around etc. My database is being queried and returning a result but as I say it is letting in users with the subdate and not letting in the users with the date that expires in the future. Everything else in my site is working very well. Any thoughts would help. Marie
  5. The following code has been working for me. I have placed this in the config file. //create a session if (!isset($_SESSION)) { session_start(); } //store the current time $now = time(); // get the time the session should have expired $limit = $now - 60 * 30; // check the time of the last activity if (isset ($_SESSION['last_activity']) && $_SESSION['last_activity'] < $limit) { // if too old, clear the session array and redirect $_SESSION = array(); header('Location: http://xxxxxxxxxxxx/expired.php'); exit; }else { //otherwise, set the value to the current time $_SESSION['last_activity'] = $now; }
  6. I have gone into the database and explored what might happen after PayPal has been activated and is live. So I have manually changed some of the expiry dates of my users. This is my code when the registrant originally joins: $q = "INSERT INTO users (username, email, pass, first_name, mid_initial, last_name, agree, date_expires) VALUES ('" . stripslashes($u) . "', '$e', '" . get_password_hash($p) . "', '" . stripslashes($fn) . "', '" . stripslashes($mi) . "', '" . stripslashes($ln) . "', '$agree', SUBDATE(NOW(), INTERVAL 1 DAY) )"; Thus their expiry date is one day less than when they joined. The whole time I have been testing my site I have left these dates and my registrants have always been allowed into the site as long as their passwords and email are correct, even though the login form is asking for a date that is greater than or equal to NOW so that doesn't make sense to me. I am assuming NOW means right this minute. $q = "SELECT id, username, type, IF(date_expires >= NOW(), true, false) FROM users WHERE (email='$e' AND pass='" . get_password_hash($p) . "')"; SO I went in and changed some of the years from the current year to a year in the future. THESE registrants are not being allowed into the site. These registrants are getting the following error message when they try to login. $login_errors['login'] = 'The email address and password do not match those on file. '; This doesn't make any sense to me and I am wondering if this alone would keep the registrant from entering the site once paypal is integrated. I have found that one can only do so much testing when the site is "live" with PayPal because if you try to use a credit card too many times, PayPal blocks you. So I want to try to figure out as many bugs as I can beforehand. Marie
  7. I have had this problem and it could mean that the database is not being queried correctly. I am no expert in this but the top of your Index page looks fine and as it is in the book. Your form is posting to your Index page. However, this line does not look correct to me. There is nothing associated with your "date_joined" column. $q = "SELECT id, profile_type, date_joined FROM Profiles WHERE (email='$e' AND password='" . get_password_hash($p) . "')"; The book as this as follows: $q = "SELECT id, username, type, IF(date_expires >= NOW(), true, false) FROM users WHERE (email='$e' AND pass='" . get_password_hash($p) . "')"; I would try some different test queries and see what happens. Marie
  8. Keep at it and you will learn A LOT. Larry has other books on PHP and MySql, etc. that you should look at as well. It helps to have other sources. Marie
  9. Okay I understand that your navigation and login form is in your header file rather than your footer file and that you are following the book for the most part. The fact that you have your navigation and login in your header file or footer file shouldn't make any difference. That should work. For instance mine is neither in the header or footer. In your above post you show only four files in your includes file. I do not see a form_functions.inc.php or config.inc.php in your list. I believe that your login.inc.php should stay in that directory. Also, if you have changed the title of that folder then make sure that it is spelled that way in all of your references. Check and make sure where you posting is going to once your user hits "submit". In the book, I believe that once a person has logged on they go to the Index.php page. Maybe that isn't where you want your logged in user to end up - in your site. Marie
  10. I don't really understand if you have your login in your Index file or header file but don't see a reason why a person couldn't login on either of those two pages. One thing I think you have to do is set up the required php documents like the following – require ('./includes/login_form.inc.php') Marie
  11. I am sure that this will be of use to me. Thank you for spending your spare time posting this code. I have gone through it but will have to get back to the forum in a few days. I went on to another area of my site and left this for the time being. As you mentioned before, having a character count isn't critical. It seems that most sites have them though. I have found that MOST codes provided work well on their own in their own page as does this one. I seem to have problems when trying to integrate JS into any of my PHP pages. Thanks again.
  12. HartleySan - Thank you for your comments. I WAS scared a little bit but can usually bounce back fairly quickly. Usually I don't post until I am tearing my hair out and I think by that time that it is something small that I am not seeing myself. I also usually try all the suggestions that people make but if I don't directly get back to someone - either on this forum or another it is because it didn't work for me. So then I sometime leave it for a few days to look at things again with fresh eyes, however, I know that other people may be looking for a response and be frustrated at trying to help but the person (me) is not getting back to the post. I will revisit the debugging techniques. For the most part I am working live, not on a local host. I have my test site nested inside another live URL so there are a few different things that can happen there. Antonio - I will check out Eclipse. I have tried Netbeans before and didn't like it all that much. As an IDE Dreamweaver doesn't bother me all that much and I also have TextWrangler. Thanks to everyone for their help. Marie
  13. I definitely have been learning from these forums - not just with the responses to my posts but I frequently go through other people's posts. You wouldn't believe how far I have come since starting my own site. When I started, I was working in Dreamweaver only which does have a character counter that works very well and is very simple. However, I soon learned that Dreamweaver couldn't do all that much and I found other sources, including your books and books and forums by others. Still it can get confusing and it appears like some PHP codes works in some situations and not in others. So that has been a bit of a struggle for me. Why does it work on one page and then I try to integrate it into a similar situation on another page and it just doesn't work. My site is almost finished and I will be revisiting the PayPal thing which wasn't quite working for me either. Anyway, maybe when I am done and actually bring in some money I can afford to hire some people to keep it up for me. Marie
  14. Yes, you are absolutely right and was coming to the same conclusion myself. However, in my defense I try only to ask for help when I think I have done everything myself to fix the situation including what debugging techniques I know and trying to relate my posts to code that is in the book. In this situation I didn't realize that this bit of code could only be done in Javascript and of course the book doesn't cover Javascript. And you are right. I have been asking myself, "Do I really need a character counter or whatever, that badly?" but thought that I WAS coding in pieces and a most of the time comparing code to other bits of codes that were simliar from the book or code that I have used before that works, so therefore, "why doesn't this code work?" Didn't realize that I may be coming across as asking people to debug my code, but if anyone is posting anything about coding then they must be in a situation where their code needs debugging. So you are saying the forums are not about codes that don't work. So that is fine, I understand. I am not going to pursue the character counter in this case. I will do it later if I find any users complaining. I did discover some interesting things after reading Antonio's post above. Thanks for all your help. With my limited experience I have also tried to help where I can. Marie
  15. Thanks, I took out the single quotes and now the page comes up which is a good thing BUT the character limit is not working nor is the character count. The words can be entered forever. So this is the basic problem that I had when I started working on this area. I don't really need the "That's All Folks" in there anyway and I tried several different ways of getting that out of there and was getting syntax errors. Someone suggested above that I have too many inputs which is probably a problem. I have rearranged this but no change and the box stays the same size no matter what. I know this has to be something stupid and something small but if I knew everything I wouldn't be posting to the forum. I am learning - comma by comma and semi-colon by semi-colon. Believe it or not. Following is the forms_function.inc.php code – } elseif ($type == 'textarea') { // Create a TEXTAREA. // Display the error first: if (array_key_exists($name, $errors)) echo ' <span class="error">' . $errors[$name] . '</span>'; // Start creating the textarea: echo '<textarea name="description" id="description" rows="10" cols="54" value="<? =$row[7] ?>"onkeyup="getCharCount(50)"'; // Add the error class, if applicable: if (array_key_exists($name, $errors)) { echo ' class="error">'; } else { echo '>'; } // Add the value to the textarea: if ($value) echo $value; // Complete the textarea: echo '</textarea>'; Following is the PHP code - <p><strong>Description:</strong></p> <textarea name="description" >' . $row[7] . '</textarea> <div id="charCount"></div> <script type="text/javascript"> function getCharCount(limit) { var tArea = document.getElementById("description"), countDisplay = document.getElementById("charCount"); countRemains = limit - tArea.value.length countDisplay.innerHTML = "Total characters : " + tArea.value.length + " Remaining: " + countRemains; if (countRemains < 1) alert(Thats all folks); } </script> <p><h2> Are you sure you want to delete your Notice?</h2></p> <input type="radio" name="sure" value="Yes" /> Yes <input type="radio" name="sure" value="No" checked="checked" /> No</br> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="id" value="' . $id . '" /> </form>';
  16. Hello, Thanks for your suggestions. I have done quite a lot of experimenting but keep getting the same error. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /page.php on line 367 Line 367 would be the following: if (countRemains < 1) alert('Thats all folks'); Following is the code in the forms_functions.inc.php } elseif ($type == 'textarea') { // Create a TEXTAREA. // Display the error first: if (array_key_exists($name, $errors)) echo ' <span class="error">' . $errors[$name] . '</span>'; // Start creating the textarea: echo '<textarea name="description" id="description" rows="5" cols="40" value="<? =$row[7] ?>"onkeyup="getCharCount(50)"'; // Add the error class, if applicable: if (array_key_exists($name, $errors)) { echo ' class="error">'; } else { echo '>'; } // Add the value to the textarea: if ($value) echo $value; // Complete the textarea: echo '</textarea>'; Following is my php code - echo '<form action="page.php" method="post"> <p><strong>Description:</strong></p> <textarea name="description" rows="5" cols="45">' . $row[7] . '</textarea> <div id="charCount"></div> <script type="text/javascript"> function getCharCount(limit) { var tArea = document.getElementById("description"), countDisplay = document.getElementById("charCount"); countRemains = limit - tArea.value.length countDisplay.innerHTML = "Total characters : " + tArea.value.length + " Remaining: " + countRemains; if (countRemains < 1) alert('Thats all folks'); } </script> <p><h2> Are you sure you want to delete your Notice?</h2></p> <input type="radio" name="sure" value="Yes" /> Yes <input type="radio" name="sure" value="No" checked="checked" /> No</br> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="id" value="' . $id . '" /> </form>'; ?> Thanks
  17. Thank you both for you help. Everything that was suggested was absolutely correct. My page is working well enough right now and the word "Agree" is now being sent to the database. The big problem in the first place was the forms function page which I was forgetting about when I first added the radio button. I have been checking around and there doesn't seem to be any way to make the checkbox bigger but that is a problem for another day. Debugging methods are really the way to go and something that I usually don't want to take the time to use but in the end would save time.
  18. Hello, I am trying to implement this code into a php script. By itself on a separate page it works fine but wihint a php page I keep getting syntax errors. Thanks, Marie <textarea name="description" id="description" rows="5" cols="40" value="sdf" onkeyup="getCharCount(50)" /> </textarea> <div id="charCount"></div> <script type="text/javascript"> function getCharCount(limit) { var tArea = document.getElementById("description"), countDisplay = document.getElementById("charCount"); countRemains = limit - tArea.value.length countDisplay.innerHTML = "Total characters : " + tArea.value.length + " Remaining: " + countRemains; if (countRemains < 1) alert('Thats all folks'); } </script>
  19. I have done some reworking and believe my problems were in the form functions page as you have suggested. However, some new problems have developed and I would say that these are also in the same form functions page. I am now getting an error message but it is showing up between the check box and the form wording. Also, the word "on" is being entered into the database rather than the word "Agree". I would just like to clarify a few things from your previous posts. "not using ascii codes for special chars in your html e.g. change '-' to ." Are you referring to this type of code? '/^[A-Z \'.-]{2,20}$/i', so I should be entering '/^[AZ \'.]{2,20}$/i', "including styling within the html" Are up referring to the following type of code? <strong>First Name</strong> Should I be using css here? "Also, please put your code samples within code tags from now on. It makes it a lot easier to look at. Thank you." and "Also, PLEASE put your code without code tags." I am not sure if you are talking about the same thing. Following is my code from the forms function page within the code tags that are on this page. Is this the proper format? } elseif ($type == 'checkbox') { // Create a CHECKBOX. // Start creating the input: echo '<input type="' . $type . '" name="' . $name . '" id="' . $name . '" true"'; // Add the value to the input: if ($value) echo ' value="' . htmlspecialchars($value) . '"'; // Display the error: if (array_key_exists($name, $errors)) { echo 'class="error" /> <span class="error">' . $errors[$name] . '</span>'; } else { echo ' />'; } It is great that you people are willing to help, so I would like to follow the prescribed methods. Thanks, Marie
  20. Thank you, I do appreciate all comments. I didn't realize that I was using some non-standard practices. I had used a capital letter on the "Agree" column in the database so this is why I was using a capital in my code, but I have changed this in all areas. Using a checkbox is a better idea. I have reworked some of the form code many times since seeing your above reply and have posted it the way it is currently. It seems I am having the same problem as I did when a radio button was included. I am not getting the error message AND it seems the rest of the information will still be sent to the database whether the checkbox is checked or not. Obviously I only want anything to go to the database when everything is filled out. I would rather not use Javascript and don't understand why php would work with the rest of the fields but not with a checkbox or radio button. Thanks for your help if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Check for an agreement: if (isset($_POST['agree']) && ($_POST['agree'] == TRUE)) { $agree = mysqli_real_escape_string($connect, $_POST['agree']); } else { $reg_errors['agree'] = 'Please agree to the user Terms and Conditions.'; } // Check for a first name: if (preg_match ('/^[A-Z \'.-]{2,20}$/i', stripslashes($_POST['first_name']))) { $fn = mysqli_real_escape_string ($connect, $_POST['first_name']); } else { $reg_errors['first_name'] = 'Please enter your first name or NA!'; } // Check for a middle name: if (preg_match ('/^[A-Z \'.-]{1,20}$/i', stripslashes($_POST['mid_initial']))) { $mi = mysqli_real_escape_string ($connect, $_POST['mid_initial']); } else { $reg_errors['mid_initial'] = 'Please enter your middle name or initial or NA!'; } // Check for a last name: if (preg_match ('/^[A-Z \'.-]{2,40}$/i', stripslashes($_POST['last_name']))) { $ln = mysqli_real_escape_string ($connect, $_POST['last_name']); } else { $reg_errors['last_name'] = 'Please enter your last name or NA!'; } // Check for a username: if (preg_match ('/^[A-Z0-9 \'.-]{2,30}$/i', stripslashes($_POST['username']))) { $u = mysqli_real_escape_string ($connect, $_POST['username']); } else { $reg_errors['username'] = 'Please enter a desired name!'; } // Check for an email address: if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($connect, $_POST['email']); } else { $reg_errors['email'] = 'Please enter a valid email address!'; } // Check for a password and match against the confirmed password: if (preg_match ('/^(\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*){6,20}$/', $_POST['pass1']) ) { if ($_POST['pass1'] == $_POST['pass2']) { $p = mysqli_real_escape_string ($connect, $_POST['pass1']); } else { $reg_errors['pass2'] = 'Your password did not match the confirmed password!'; } } else { $reg_errors['pass1'] = 'Please enter a valid password!'; } if (empty($reg_errors)) { // If everything's OK... <form action="Register.php" method="post" accept-charset="utf-8" style="padding-left:200px"> <p><strong> All registered users must be of 18 years of age or older and agree<br /> to the Terms and Conditions in the following link <a href="UserAgree.html">Terms and Conditions</a>.</strong></p> <p class="noticeType"><input type="checkbox" name="agree" value="agree" />I agree to the user Terms and Conditions.</p> <?php create_form_input('agree', 'checkbox', $reg_errors); ?> <p><label for="first_name"><strong>First Name</strong></label><br /> <p class="noticeType">Please enter your first name or NA if non applicable.</p> <?php create_form_input('first_name', 'text', $reg_errors); ?></p> <p><label for="mid_initial"><strong>Middle Name or Initial</strong></label><br /> <p class="noticeType">Please enter your middle name or initial or NA if non applicable.</p> <?php create_form_input('mid_initial', 'text', $reg_errors); ?></p> <p><label for="last_name"><strong>Last Name</strong></label><br /> <p class="noticeType">Please enter your last name or initial or NA if non applicable.</p> <?php create_form_input('last_name', 'text', $reg_errors); ?></p> <p><label for="username"><strong>Desired Username</strong></label><br /> <p class="noticeType">Only a combination of letters and numbers are <br />allowed with no special characters — from<br /> two to thirty in total.</p> <?php create_form_input('username', 'text', $reg_errors); ?> </p> <p><label for="email"><strong>Email Address</strong></label><br /> <p class="noticeType"> Please enter a valid email address and check your spelling.<br />Our website will recognize a proper email format but not typrographical errors.</p><?php create_form_input('email', 'text', $reg_errors); ?></p> <p><label for="pass1"><strong>Password</strong></label><br /> <p class="noticeType"> Must be between 6 and 20 characters long, with at least one lowercase letter, <br /> one uppercase letter, and one number.</p> <?php create_form_input('pass1', 'password', $reg_errors); ?></p> <p><label for="pass2"><strong>Confirm Password</strong></label><br /></p> <?php create_form_input('pass2', 'password', $reg_errors); ?></p> <p><input type="submit" name="submit_button" value="Register →" id="submit_button" class="formbutton" /></p> </form>
  21. Below is what I have for the validation code and then the form. I didn't want to post too much code so I guess I didn't post enough. Basically I was trying to follow along with the code that I already have for the other form elements. So I haven't tried the futher suggestions yet, in case the solution would be very simple. The page was working fine before I added the radio button and the "Agree" was being added to the database. However, IF the person didn't check the radio button, there was no warning being echoed. if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['Agree'])) { $Agree = mysqli_real_escape_string($connect, $_POST['Agree']); } else { //print $reg_errors['radio_Agree'] = 'Please agree to the user Terms and Conditions.'; $reg_errors[] = 'Please agree to the user Terms and Conditions.'; } // Check for a first name: if (preg_match ('/^[A-Z \'.-]{2,20}$/i', stripslashes($_POST['first_name']))) { $fn = mysqli_real_escape_string ($connect, $_POST['first_name']); } else { $reg_errors['first_name'] = 'Please enter your first name or NA!'; } // Check for a middle name: if (preg_match ('/^[A-Z \'.-]{1,20}$/i', stripslashes($_POST['mid_initial']))) { $mi = mysqli_real_escape_string ($connect, $_POST['mid_initial']); } else { $reg_errors['mid_initial'] = 'Please enter your middle name or initial or NA!'; } // Check for a last name: if (preg_match ('/^[A-Z \'.-]{2,40}$/i', stripslashes($_POST['last_name']))) { $ln = mysqli_real_escape_string ($connect, $_POST['last_name']); } else { $reg_errors['last_name'] = 'Please enter your last name or NA!'; } // Check for a username: if (preg_match ('/^[A-Z0-9 \'.-]{2,30}$/i', stripslashes($_POST['username']))) { $u = mysqli_real_escape_string ($connect, $_POST['username']); } else { $reg_errors['username'] = 'Please enter a desired name!'; } // Check for an email address: if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($connect, $_POST['email']); } else { $reg_errors['email'] = 'Please enter a valid email address!'; } // Check for a password and match against the confirmed password: if (preg_match ('/^(\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*){6,20}$/', $_POST['pass1']) ) { if ($_POST['pass1'] == $_POST['pass2']) { $p = mysqli_real_escape_string ($connect, $_POST['pass1']); } else { $reg_errors['pass2'] = 'Your password did not match the confirmed password!'; } } else { $reg_errors['pass1'] = 'Please enter a valid password!'; } if (empty($reg_errors)) { // If everything's OK... <form action="Register.php" method="post" accept-charset="utf-8" style="padding-left:200px"> <p><strong> All registered users must be of 18 years of age or older and agree<br /> to the Terms and Conditions in the following link <a href="UserAgree.html">Terms and Conditions</a>.</strong></p> <p><label> <input type="radio" name="Agree" value="Agree" /></label> <a name="Agree" id="Agree"></a>I agree to the user Terms and Conditions.<br /> <?php create_form_input('radio', 'Agree', $reg_errors); ?></p> <p><label for="first_name"><strong>First Name</strong></label><br /> <p class="noticeType">Please enter your first name or NA if non applicable.</p> <?php create_form_input('first_name', 'text', $reg_errors); ?></p> <p><label for="mid_initial"><strong>Middle Name or Initial</strong></label><br /> <p class="noticeType">Please enter your middle name or initial or NA if non applicable.</p> <?php create_form_input('mid_initial', 'text', $reg_errors); ?></p> <p><label for="last_name"><strong>Last Name</strong></label><br /> <p class="noticeType">Please enter your last name or initial or NA if non applicable.</p> <?php create_form_input('last_name', 'text', $reg_errors); ?></p> <p><label for="username"><strong>Desired Username</strong></label><br /> <p class="noticeType">Only a combination of letters and numbers are <br />allowed with no special characters — from<br /> two to thirty in total.</p> <?php create_form_input('username', 'text', $reg_errors); ?> </p> <p><label for="email"><strong>Email Address</strong></label><br /> <p class="noticeType"> Please enter a valid email address and check your spelling.<br />Our website will recognize a proper email format but not typrographical errors.</p><?php create_form_input('email', 'text', $reg_errors); ?></p> <p><label for="pass1"><strong>Password</strong></label><br /> <p class="noticeType"> Must be between 6 and 20 characters long, with at least one lowercase letter, <br /> one uppercase letter, and one number.</p> <?php create_form_input('pass1', 'password', $reg_errors); ?></p> <p><label for="pass2"><strong>Confirm Password</strong></label><br /></p> <?php create_form_input('pass2', 'password', $reg_errors); ?></p> <p><input type="submit" name="submit_button" value="Register →" id="submit_button" class="formbutton" /></p> </form>
  22. Thanks, Okay I just changed that and when I submit the form, all the other warnings are being printed but the – 'Please agree to the user Terms and Conditions.', which has been my main problem.
  23. Hello, I have been trying to get my form to validate the radio button which allows my user to agree to the terms and conditions, however, it either prints at the top of the page or not at all. The other prompts print near the form input which is what I would like to happen for the radio button. Following is my code. if (isset($_POST['radio_Agree'])) { $Agree = mysqli_real_escape_string($connect, $_POST['Agree']); } else { $reg_errors['radio'] = 'Please agree to the user Terms and Conditions.'; } <p><label> <input type="radio" name="Agree" value="Agree" /></label> <a name="Agree" id="Agree"></a>I agree to the user Terms and Conditions.<br /> <?php create_form_input('radio', 'Agree', $reg_errors); ?></p>
  24. Thank you, That worked. I guess my code was getting sloppy. Now to figure out how to add a character counter.
×
×
  • Create New...