PHP - Part 5 - Form Handling

PHP Part 5 Form - CIS 4004 Web-Based Information Technology Spring 2011 Introduction to PHP Part 5 Form Handling Instructor Dr Mark Llewellyn

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

View Full Document Right Arrow Icon
CIS 4004: PHP – Part 5 – Form Handling Page 1 Dr. Mark Llewellyn © CIS 4004: Web-Based Information Technology Spring 2011 Introduction to PHP – Part 5 – Form Handling Department of Electrical Engineering and Computer Science University of Central Florida Instructor : Dr. Mark Llewellyn [email protected] HEC 236, 407-823-2790 http://www.cs.ucf.edu/courses/cis4004/spr2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
CIS 4004: PHP – Part 5 – Form Handling Page 2 Dr. Mark Llewellyn © Form Handling In PHP This set of notes will focus on handling forms in PHP. If you need a refresher on generating forms and the various XHTML elements that might appear in a form, I suggest you go back and review the XHTML notes Advanced XHTML & CSS – Tables And Forms that we covered earlier in the course. What we want to do here is focus on the PHP side of things and not the XHTML side. Recall in the earlier set of notes that when we created a form, the action attribute simply caused an email to be sent to the address specified by the action attribute. What we want to do here though is cause a PHP script to be executed and the data from the form made available to the script.
Background image of page 2
CIS 4004: PHP – Part 5 – Form Handling Page 3 Dr. Mark Llewellyn © Form Handling In PHP Depending on what method was used to submit the form data to the PHP script (either GET or POST), PHP has two superglobal arrays , called $_GET and $_POST , that will be used to store the data contained in the form. $_GET and $_POST are associative arrays that contain, as key values, the names of the form elements as specified by their name attribute and their associated values as submitted by the user. You may recall that we saw an example of this in the introductory set of PHP notes. That example is duplicated on the next two pages to refresh your memory. Note: The term superglobal refers to variables that are generated by the PHP and are always in scope. This means that regardless of where you are in a PHP script, whether it be inside a function or elsewhere, a superglobal variable is always available without needing to use the global statement to bring the variable into the current scope.
Background image of page 3

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

View Full DocumentRight Arrow Icon
CIS 4004: PHP – Part 5 – Form Handling Page 4 Dr. Mark Llewellyn © Form Handling In PHP XHTML document
Background image of page 4
CIS 4004: PHP – Part 5 – Form Handling Page 5 Dr. Mark Llewellyn © Form Handling In PHP PHP script
Background image of page 5

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

View Full DocumentRight Arrow Icon
CIS 4004: PHP – Part 5 – Form Handling Page 6 Dr. Mark Llewellyn © Form Handling In PHP For reasons of internationalization, get has been deprecated as a value for the method attribute in XHTML form elements. So we will focus exclusively on the post value for the method attribute and thus the $_POST superglobal array. In earlier versions of PHP (those prior to 4.1.0), PHP created,
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/04/2011 for the course CIS 4004 taught by Professor Staff during the Spring '11 term at University of Central Florida.

Page1 / 54

PHP Part 5 Form - CIS 4004 Web-Based Information Technology Spring 2011 Introduction to PHP Part 5 Form Handling Instructor Dr Mark Llewellyn

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

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