Visit the Official PHP Website
By James N Hitz
Lesson 6 was short! Short and thorough. If you have come straight from Lesson 6 then you might have wondered how I got to merge Lessons like that. I feel Lesson 6 and 7 complement each other and that is the reason for the Mighty Skiiiiiiip.
In Lesson 6 we talked about what happens when a user enters form data to be be used by a PHP script. In the lesson we outlined some of the considerations that you will have to put in mind when preparing your HTML forms to be used with PHP.
Just as to jog ya' brains, you will remember we said that:
- all your HTML form widgets must have a name attribute
- all your form widgets representing the same subject SHOULD have the same name
- some widgets, eg. hidden controls, check boxes, radio buttons, command butons (submit, reset, button) MUST have a value attribute for them to be PHP-friendly
- a form must have an action property specifying the PHP script to be executed on submission. Of course every form must have one <SUBMIT> button
- always set a METHOD for the form to either PUT or POST - PUT for small forms, POST for large forms (I said I'll use POST all through my examples
- in your PHP scripts, DONT TRUST THE USER TO DO THE RIGHT THING. Always validate your scripts.
- when validating, you can use relational operators but they only provide you with MINIMAL power. Use regular expressions instead.
The last point is what I did not make clear. What are regular expressions?
<< Back to beginning of Lesson 6 | Regular Expressions >>