: 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.