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! :D 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:

Making the HTML form functional:

  • Remember to use the $_POST superglobal when using method="post" in your form, and the $_GET superglobal when using method="get" in your form.
  • The value you pick for the name attribute 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!

Posted on February 13th, 2007 | Leave a comment | Trackback URL

4 Comments

  1. Ultra Lean Green

    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.

  2. quimkaos

    January 10th, 2009

    i agree it’ beeter wen liz is liz’s videos

  3. imspoiled1983

    February 2nd, 2009

    i just found this site a couple days ago, and it’s been extremely helpful. Liz breaks down the gibberish and explains it clearly. Thanks!

  4. Kellie

    December 3rd, 2009

    Good job on getting the form working! I’m going to have to re-watch this video when I get home. I didn’t my headphones today either.. so I set the volume REALLY low so I don’t distract my co-worker lol

Share Your Thoughts