Use php to make a simple form

Source: Internet
Author: User
One of the most useful features of PHP is its ability to actively assign variable values in the form to PHP variables. This makes form processing very quick. Therefore, if you send a form containing the input field VALUE: INPUTTYPE = TEXTNAME = "name" VALUE = "Glen

One of the most useful features of PHP is its ability to actively assign variable values in the form to PHP variables. This makes form processing very quick.

Therefore, if you send a form containing the input field value, the following is returned:

When you use PHP to process this page, the value of the $ name variable will be Glen Morris.

Therefore, you can print the value in the following way:

Echo 'Hi $ name! ';

Or test its value like this:

If ($ name = 'Glen Morris ') {echo 'Please check your email .';}

There is a good way to process basic forms with PHP. For example, we need to make a simple questionnaire survey. the request writer must fill in their names, email addresses, and reply to some of our favorite titles.

First, we split the page into two functions. Therefore, we only need to write a PHP page and use the program logic to hold the display content to the user, instead of writing two separate webpages (one for the form part, another CGI script for processing forms ).

Display form

The first function is used to display the form:

Functiondisplay_form (){

Global $ PHP_SELF;

?>

}

?>

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.