PHP Day 9: Using PHP with HTML Forms
Last night I made my first functional HTML form using PHP! It’s very basic, but it works!
This five-minute video shows what I learned — not much, but enough to get started.
Links for PHP Day 9: Using PHP with HTML Forms
PHP superglobals:
- PHP: Predefined Variables - PHP Superglobals - A list of the superglobals, which are predefined variables that are always available.
- PHP Video Tutorial: Processing Forms with PHP - Part 2 - A video from KillerPHP.com that I found somewhat helpful.
Making the HTML form functional:
- Remember to use the
$_POSTsuperglobal when usingmethod="post"in your form, and the$_GETsuperglobal when usingmethod="get"in your form. - The value you pick for the
nameattribute for the inputs in your HTML form will be the key for the superglobal array, as in$_POST['inputname']. - Note: in the video, I didn’t put quotes around the key (I wrote
$_POST[firstname]instead of$_POST['firstname']), which is bad practice. Oops!
Next up, PHP security issues. Hurray!



July 31st, 2008
I like the videos when you are in them!
So I made a form, but when I click the back button all the data is gone.
Do you know how we can make the form sticky so that if i hit submit & then hit the back button the data will still be their or if I use a multi step form I can go back to change the data.