PHP program development example learning: getting the value of a text box from a form

Source: Internet
Author: User

<Form name = "form" method = "post" action = "login. php"> </form>
Text Box usage:
<Input type = "text" name = "username"/>
Among them, the input types include text, password, and so on. HTML5 adds a lot of input types. If you want to learn this type of knowledge, you can have a good understanding, because the finer the score, the more convenient it is to use.
  
Check the functions of this instance.

After filling in the form and submitting it:


Implementation Code:

Copy codeThe Code is as follows: <table width = "283" height = "85" border = "1" cellpadding = "0" cellspacing = "0">
<Form name = "name1" method = "post" action = "abc. php">
<Tr>
<Td width = "114" height = "30" align = "center"> administrator: </td>
<Td width = "163" height = "30" align = "center"> <input name = "username" type = "text"/> </td>
</Tr>
<Tr>
<Td align = "center"> password: </td>
<Td height = "30" align = "center"> <input name = "password" type = "password"/> </td>
</Tr>
<Tr>
<Td> </td>
<Td height = "25"> <input name = "submit" type = "submit" value = "submit"/> </td>
</Tr>
</Form>
</Table>
<? Php
If (! Isset ($ _ POST ['submit '])
Return;
If ($ _ POST ['submit '] = 'submit '){
$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['Password'];
}
Echo <EOT
<Table width = "284" border = "1" cellpadding = "0" cellspacing = "0">
<Tr>
<Td height = "25" align = "center"> administrator: $ username </td>
</Tr>
<Tr>
<Td height = "25" align = "center" valign = "middle" class = "style2"> password: $ password </td>
</Tr>
</Table>
EOT;
?>

Use the isset () function to determine whether $ _ POST ['submit '] is set

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.