Cameron Garnett/Testpage12
Contents
Super Quick PHP Tutorial
Introduction | Basic Syntax | Sending Data to the Browser | Comments | Variables | Strings | Functions | Quotes | Debugging | Form
Learning ObjectivesBy the end of this page you will know how to extract information from a html form and print it using php code. |
Forms
One of the most powerful features of PHP is the way it handles HTML forms. The basic concept that is important to understand is that any form element will automatically be available to your PHP scripts.
ACTIVITYWrite the above block of code into Notepad++ and save as form.html |
ExampleHi <?php echo htmlspecialchars($_POST['name']);?>. |
ACTIVITYWrite the above block of code into Notepad++ and save as action.php into your web folder |
For your browser to parse the form it has to be opened by typing a url similar to http://localhost/form.html
When you hit the submit button your browser will parse the information you have entered into the form and display the message in the action.php file.