|
PHP Tutorial Home
Basic PHPPHP IntroductionPHP Installation PHP Syntax PHP Variables PHP Form Variables PHP If Statements PHP Switch Statements PHP Arrays PHP While Loops PHP For Loops PHP Operators PHP Functions Advanced PHPPHP IncludePHP Upload File PHP File PHP Mail PHP Mail Configuration PHP Database Driven Website PHP Summary FREE Hosting!With every domain name you register with ZappyHost, you get FREE hosting.$1.99 Domain NamesWith every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99. |
PHP Form VariablesMany website applications rely on HTML forms so that users can perform their tasks. For example, most Content Management Systems allow users to provide content for a website by entering the content into a textarea form field, then clicking a "Save" button. When the user clicks the Save button, the form is submitted to the action page. The action page is normally specified with the action attribute of the form tag. If you're not familar with HTML forms, see the HTML forms section of the HTML tutorial, then return to this page. Once a form has been submitted, the form fields are made available to the action page as a special type of variable. You, as the programmer, can read these form variables by using the appropriate syntax for form variables. Form variables are stored as an array. We will be covering arrays later, but for now all you need to know is how to read each form variable. Forms can be submitted using one of two methods: get or post. By default, a form will be submitted using the "get" method. This results in each form variable being passed via the URL. If you decide to use the "post" method, you specify this using the method attribute ( The Get MethodIf you use the get method, your action page can access each form field using ExampleForm page Display: Code:
Action page (php_action_page.cfm): Here, the action page outputs the contents of the form variables that were passed from the form.
The Post MethodIf your form uses the post method, you use ExampleForm page Display: Code:
Action page (php_action_page.cfm): Here, the action page outputs the contents of the form variables that were passed from the form.
Enjoy this website?
Oh, and thank you for supporting Quackit! |
Need Content for your Website?Get unique, quality digital content for your website. You can even earn money by reselling it!Includes:
|