The Form * It will produce a form to ask the user for his or her first name, last name, and birthdate. * It will also instruct the user to mark his or her favorite programming languages from a list of four (your choice). * The birthdate should be handled by three separate fields: month (MM), day (DD), and year (YYYY). * Use <select> elements for each field. * Create an array for the month names and the last day of the month. * Use a loop to generate the items in each of the three <select> dropdown menus. * For the years, use a loop to generate years up to 18 years ago. Perform the following data validations * If a user enters a name (first or last) that includes characters that could cause problems for the script or a database, strip slashes to the input. * If any input is missing, allow the user to make changes before the form data is processed. * Prevent the user from passing data/values in through the URL/address bar. * Extra Credit Only: Verify the day of the month selected does not exceed the number of days in the month given. Processing * Produce a standard "Thank you" page with "Thank You [user's first name]" in the <title>. * In the <body>, thank the user for his/her input. * Display all data entered for confirmation. Display the date in the format MM/DD/YYYY. * Present the user's choice(s) of favorite programming languages in an unordered list. Display the message, "You did not choose any programming languages" if the programming languages array is empty. Do not allow the script to error-out. I am having trouble with this assignment.
-start off by making a normal html form http://www.tizag.com/phpT/examples/formex.php -for the 1-18 thing just use -parse the data via php with $_POST -take a look at the addslashes(); function The rest is up to you
The two pieces that were giving me trouble are the year which I appreciate the help with and the array created with the months. I already created the HTML form.
Hi, for the months, use a 2d array $months = array( array("January", 31), //... array("Novembre", 30), array("Decembre", 31) ); PHP: You can then call this by: echo $months[0][1]; // January echo $months[0][2]; // 31 days //etc echo $months[11][1]; // December echo $months[11][2]; // 31 days PHP: