[Php] numeric transfer between basic syntax and page

Source: Internet
Author: User
: This article mainly introduces the basic syntax of [php] and the value transfer between pages. if you are interested in the PHP Tutorial, refer to it. Let's talk about the previous example ~

I. basic objectives

Set a form in phpsend.html. The value entered above can be received by phpget. php.


II. Production process

Like javascript, values in php are of no type. a dollar represents a value,

Then, if you want to use this variable, add this $ to indicate that this is a variable.

The for, switch case, while, if else and other structures in different languages still exist.

! =, = And other operators also exist

In the echo output language, $ {a certain variable} is used to forcibly set the value of the output variable.

(1)phpsend.html

This is a static page that does not require any server language processing. as long as the action points to the phpget. php to be processed,

However, pay attention to the transfer method of multiple box values.

 phpsend

(2) phpget. php
 Phpget
 "; Echo"
"; $ Password = $ _ REQUEST [" password "]; echo" password: $ {password} "; echo"
"; Echo"
"; // Because the drop-down menu name = education in form is passed in 1, 1, 2, and 3, // use the switch structure to handle $ education =$ _ REQUEST ["education"]; switch ($ education) {case 0: echo "education: pupils"; break; case 1: echo "Education: Middle school student"; break; case 2: echo "Education: College student"; break; case 3: echo "Education: other"; break;} echo"
"; Echo"
"; $ Sex = $ _ REQUEST [" sex "]; echo" Gender: $ {sex} "; echo"
"; Echo"
"; // Echo" hobbies: "; // Here, favor is an array. The first element of this array is the first selected element of the check box, then, the second element is the second selected element of the check box, and so on $ favor = $ _ REQUEST ["favor"]; // count ($ favor) it is equivalent to favor in jsp. length (), ubound (favor) in asp, evaluate the array length for ($ I = 0; $ I "; Echo"
"; // The following method outputs the favor array at one time echo" hobbies: "; foreach ($ favor as $ a) echo" $ {a}, "; echo"
"; Echo"
"; $ Ps = $ _ REQUEST [" ps "]; echo" remarks: $ {ps} "; echo"
"; Echo"
";?>

The above introduces the basic syntax of [php] and the value transfer between pages, including some content. I hope my friends who are interested in the PHP Tutorial will be helpful.

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.