Uploaded by Linn Latt Hsu

Exercise 9

advertisement
1.
Membership Form
Thanks for choosing to join The Widget Club. To register, please fill in your details below and
click Send Details.
First name
Last name
Su
Su
Choose a password
Retype password
Are you male...
...or female?
What are your favorite widgets?
The SuperWidget
The MegaWidget
The WonderWidget
Do you want to receive our ‘Widget Times’ newsletter?
Do you want to receive our ‘Fun with Widgets’ newsletter?
Good
Any comments?
Send Details
Reset Form
Output Form
Thank You
Thank you for registering. Here is the information you submitted:
First name
Su
Last name
Su
Password
123su
Retyped password
123su
Gender
F
Favorite widgets
The SuperWidget
You want to receive the following newsletters:
widgetTimes, funWithWidgets
Comments
Good
2.
Output Form
3. Create an Interactive Form with PHP
The following all-in-one PHP script does the following things:




It displays a registration form for the user to fill out. Certain fields are required to be filled
in; these are labeled with asterisks in the form. The remaining fields are optional
When the form is sent, the script checks that the required fields have been filled in
If all required fields are filled, the script displays a thank-you message
If one or more required fields are missing, the script redisplays the form with an error
message, and highlights the fields that still need to be filled in. The script remembers which
fields the user already filled in, and prefills those fields in the new form
Sample Form:
Output
Download