Archive:PHP and MySQL Programming/Form Handling: Difference between revisions
wikademia>Kencyber |
wikademia>Wikademia m moved PHP and MySQL Programming/Form Handling to Archive:PHP and MySQL Programming/Form Handling over redirect |
||
| (5 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
In order to get user input without using the command line, then you will use HTML forms. PHP has various functions and techniques for handling the input from HTML forms. In specific, we will use the special array variables $_GET[] and $_POST[]. | In order to get user input without using the command line, then you will use HTML forms. PHP has various functions and techniques for handling the input from HTML forms. In specific, we will use the special array variables $_GET[] and $_POST[]. | ||
{{ntnes}} | |||
== HTML Forms == | == HTML Forms == | ||
| Line 43: | Line 43: | ||
== POST == | == POST == | ||
To retrieve POST variables, we use the following method : | To retrieve <code>POST</code> variables, we use the following method : | ||
'''form_handler.php :''' | |||
<source lang="php"> | |||
<? | <? | ||
$username = $_POST['username']; | $username = $_POST['username']; | ||
| Line 51: | Line 52: | ||
print "Username : $username \n Password : $password \n"; | print "Username : $username \n Password : $password \n"; | ||
?> | ?> | ||
</source> | |||
Note that when POST is used, the posted data is completely invisible to the user. | Note that when <code>POST</code> is used, the posted data is completely invisible to the user. | ||
[[../Command Line Programming/|Previous: Command Line Programming]] | [[../|TOC]] | [[../Introduction to MySQL/|Next: Introduction to MySQL]] | [[../Command Line Programming/|Previous: Command Line Programming]] | [[../|TOC]] | [[../Introduction to MySQL/|Next: Introduction to MySQL]] | ||
[[Category:PHP and MySQL Programming|{{SUBPAGENAME}}]] | [[Category:PHP and MySQL Programming|{{SUBPAGENAME}}]] | ||