PHP $_get and $_post are used to retrieve values from forms

Source: Internet
Author: User
Keywords Web Programming PHP Tutorials
Tags html it is name php processing programming server text

PHP form Processing
Form instance:
<html>
<body>

<form action= "welcome.php" method= "POST" >
Name: <input type= "text" name= "name"/>
Age: <input type= "text" name= "age"/>
<input type= "Submit"/>
</form>

</body>
The HTML page example above </html> contains two input boxes and a submit button. When the user fills out the form and clicks the Submit button, the form's data is sent to the "welcome.php" file.

The "welcome.php" file looks like this:
<html>
<body>

Welcome <?php echo $_post["name";? >.<br/>
You are <?php echo $_post[' age ';?> perton old.

</body>
</html> the output sample from the script above is similar to this:

Welcome John.
You are are Perton old.
We'll explain PHP $_get and $_post in the next chapter.
Form validation
User input should be validated whenever possible. The client is validated faster and can reduce the load on the server.

However, any traffic is so high that you have to worry about the server resources of the site, it is also necessary to worry about the security of the site. If the form accesses a database, it is very necessary to use server-side validation.

A good way to validate a form on the server is to conveys it to itself rather than jump to a different page. This allows the user to get an error message on the same form page. Users are also more likely to find errors.

Related Article

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.