Lab 4 – Forms, Loops and Strings

Lab 4 -  Forms, Loops and Strings

 

Submission Instructions

 

How

 

Please submit your lab report to the Lab4_Submission folder in Moodle.

When

Labs are due in 1 week on Feb. 13, 2014

 

Exercises:

 

Goals:

 

 Gain more hands-on with using PHP string functions

 Create and integrate forms with PHP scripts. 

 

Step 1: Name field validation

 

Modify the Name field on your ISP form so that is now two text fields – one for ‘First Name and

one for ‘Last Name’.

 

 

Step 2: Email Address

 

 Add another text box to your form and label it “Email Address”.

 Set a size of the text box = 60 characters for the email address.

 Use a PHP function to validate the email address. 

 

 If the email address passes validation, echo it back to the user. 

Step 3: Password Fields and Validation

 

 Add two password fields to your ISP form.

 The first password field should be labeled “Enter Password”.

 The second password field should be labeled “Confirm Password”.

 Make that when you create the password field that you define it as type = ‘password’. 

 

 

 

Step 4: Processing String Tokens in an Address

 

Add another text box to the form you created for ISP Usage. The label for the text box should be

“Address”. It should accommodate up to 60 characters. The text string you enter should be in the

following format:

 

1024 Main St., Unit 502, Montpelier, VT02044   (no comma after the state)

 

Your job is to break the string into “tokens”. For example we’d like to be able to  store each part

of the address in a separate variable or position in an array and print each variable on a separate

line like this:

 

1024 Main St.

Unit 502

Montpelier

VT 02044

 

 nswers

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    • forms11.zip