Let's take a look at the following code form2.phphtmlheadtitlegreetinseartylingtitleheadbodyformactionformprocess2. phpmethodposttabletrtdnametdtdinputtypetextnamenametdtrtrtdgreetingstdtdselectn
Let's take a look at the following code form2.php html head title greetins eartyling/title/head body form action = "formprocess2.php" method = "post" table tr td Name/td input type = "text" name = "name" // td/tr td Greetings/td select name = "gr
Let's take a look at the following code.
Form2.php
greetins eartyling
Name |
|
Greetings |
Hello Hola Bonjour |
|
Display Debug info |
|
Formprocess2.php
Greeting earthing
Degut:'; print_r($_POST); echo '
';}?>
Select the checkbox "Display Debug info" and click "submit" to Display the following content:
Bonjour, who!
Degut:Array ([name] => who and who [greeting] => Bonjour [debug] => on [submit] => Submit)
We can see that the value of the input element can be obtained using the $ _ POST ("name") function, not just a text box, but a single-statement checkbox and a drop-down list box select, note that here, if the checkbox value is "on", it is not true, and if we do not select the checkbox, use $ _ POST ("debug") to obtain the checkbox value, an error is returned, because the $ _ POST array does not contain this element.