Create a PHP application to allow a user to register for the website and enter profile information to be stored in cookies.
Part I: Registration page
Create a page called register.php that displays a user registration form with the following fields from the customer table:
Email address - required, valid email, maxlength 60
First Name - required, maxlength 40
Last Name - required, maxlength 20
Password - required, 8-20 characters
Confirm Password - required, 8-20 characters, must match Password
Read the records from the genre table and display each one as a checkbox using the name as the label and the genreId as the value. Instruct the user to select up to 3 favorite genres. User must select at least 1 genre and no more than 3.
Add a submit button with a value of Register
When the form is submitted, validate the information and display error messages if there are any errors.
Part II: Create cookies
If the data from the form is all valid, then create cookies as follows:
name: first and last names from the form with a space in between, expires: 30 days from current date
genre1: the first genre selected by the user, expires: 1 year from current date
genre2: the second genre selected by the user, expires: 1 year from current date. If no selection was made, do not create cookie.
genre3: the third genre selected by the user, expires: 1 year from current date. If no selection was made, do not create cookie.
coupon: value = .25, temporary cookie.
Transfer to the index.html page (see next step)
Part III: Index page
Create a page called index.php
Add your header and footer functions for the html
After the header, check to see if the name cookie exists. If so, display the message: Welcome, name! where name is replaced with the value of the name cookie.
Check to see if the coupon cookie exists. If so, display the message: 'Order today to receive 25% off your entire order!".
Check to see if the genre1 cookie exists. If so, get the value and check for the genre2 and genre3 cookies and get those values also if they exist. Create a query to select a maximum of 20 tracks from the tracks table that have a genre that matches one of the genre's entered by the user. (i.e. Select from tracks where genreId = 1 or genreId = 2 or genreId = 3 limit 20).
If no genre1 cookie exists, just create a simple query to select the first 20 tracks (select from tracks limit 20)
Execute the sql query.
On the page, display a heading: "Tracks you may like"
List the Name, genreId, composer and unit price for the 20 tracks in your dataset. If the currency is anything other than US Dollars, multiply by the conversion factor from the array and display in the preferred currency.
Include a link to the register.php page.