php - part 3 - COP 4610L: Applications in the Enterprise...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 4610L: PHP – Part 3 Page 1 Mark Llewellyn © COP 4610L: Applications in the Enterprise Fall 2006 Introduction to PHP – Part 3 COP 4610L: Applications in the Enterprise Fall 2006 Introduction to PHP – Part 3 School of Electrical Engineering and Computer Science University of Central Florida Instructor : Mark Llewellyn [email protected] ENG3 236, 407-823-2790 http://www.cs.ucf.edu/courses/cop4610/fall2006
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 4610L: PHP – Part 3 Page 2 Mark Llewellyn © Dynamic Content in PHP Of all the strengths PHP exhibits as a server-side scripting language, perhaps its greatest strength lies in its ability to dynamically change XHTML output based on user input. In this final section of notes, we’ll build on the examples we’ve constructed in the previous two sets of notes by combining form.html and form.php into one dynamic PHP document named dynamicForm2.php . We’ll add error checking to the user input fields and inform the user of invalid entries on the form itself, rather than on an error page. If an error exists, the script maintains the previously submitted values in each form element. Finally, after the form has been successfully completed, we’ll store the input from the user in a MySQL database.
Background image of page 2
COP 4610L: PHP – Part 3 Page 3 Mark Llewellyn © Basically, the same registration form that was used in a previous example.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 4610L: PHP – Part 3 Page 4 Mark Llewellyn © Screen the user sees after clicking the Register button.
Background image of page 4
COP 4610L: PHP – Part 3 Page 5 Mark Llewellyn © Screen the user sees after clicking to see the entire database.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 4610L: PHP – Part 3 Page 6 Mark Llewellyn © Dynamic nature of the PHP form is illustrated when the user fails to enter proper information into the form. In this case, the user forgot to enter their first name. Error checking is in place on each user input location and the page is dynamically updated to reflect the error processing and correction capabilities. The database will not be updated until the user has correctly filled in all required fields.
Background image of page 6
COP 4610L: PHP – Part 3 Page 7 Mark Llewellyn © Screen shot from MySQL of the contacts relation after the inclusion of several users. Note that the values in the table are the same as those returned to the PHP document in the previous slide.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP 4610L: PHP – Part 3 Page 8 Mark Llewellyn © <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- dynamicForm2.php --> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>Sample form to take user input in XHTML</title> </head> <body style = "font-family: arial, sans-serif; background-color: #856363" background=background.jpg> <?php extract ( $_POST ); $iserror = false; // array of magazine titles $maglist = array( "Velo-News", "Cycling Weekly", "Pro Cycling", "Cycle Sport", "RadSport", "Mirror du Cyclisme" ); // array of possible operating systems $systemlist = array( "Windows XP", "Windows 2000", "Windows 98", "Linux", "Other"); dynamicForm2.php – page 1
Background image of page 8
COP 4610L: PHP – Part 3 Page 9 Mark Llewellyn © // array of name and alt values for the text input fields $inputlist = array( "fname" => "First Name", "lname" => "Last Name", "email" => "Email",
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/14/2011 for the course COP 4610L taught by Professor Staff during the Spring '09 term at University of Central Florida.

Page1 / 31

php - part 3 - COP 4610L: Applications in the Enterprise...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online