![]() |
|
![]() PHP FAQ PHP Articles PHP Help Bulletin Board PHP Manual (NEW!) First Time PHP'ers Help with programming Sql assignment help PHP Homework Help
|
Retrieving The Input When Submit is Clicked Now we will add a simple condition to the beginning of our previous example. If the user clicked the submit button then print out the name that was entered in the text field; otherwise, we display the HTML form again. Because the action in the form points to input.php3 our script will be called again when the user clicks submit. PHP Code:
When a form is submitted, all HTML variables are passed to a PHP script and assigned their respective variable names. In our example, the input text field is named "UserName" so when the form is submitted $UserName will hold the value. The variable $submit, that corresponds to the input name="submit", will hold the value "click". It is only set if we click the submit button and not when we directly access input.php3 with our browser.
|