Knowledge Points:
mutable variable: Simply put the value of one variable as the name of another variable, e.g. $ A = ' B '; $ $a is $b.
HTML code:
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "UTF-8">5 </Head>6 <Body>7 <formAction= "show.php"Method= "POST">8 <inputname= "User"><BR>9 <inputname= "Age" ><BR>Ten <inputname= "Email"><BR> One <inputname= "Cellphone"><BR> A <inputtype= "Submit"><BR> - </form> - </Body> the </HTML>
Common PHP Processing:
1 <?php
2 $user=$_post[' User '];3 $age=$_post[' Age '];4 $email=$_post[' Email '];5 $cellphone=$_post[' Cellphone '];6 7 Echo' Name: '.$user;8 Echo' Age: '.$age;9 Echo' Email: '.$email;Ten Echo' Mobile phone number: '.$cellphone; One A -
If the form content is too much, this assignment will also be a lot of operation, here we use variable variable +foreach loop, can be more convenient, as follows:
foreach ($_postas$key$value) { $$key$value; } Echo ' Name: '. $user ; Echo ' Age: '. $age ; Echo ' Email: '. $email ; Echo ' Mobile phone number: '. $cellphone ;
Reference post: http://blog.csdn.net/engine_1124/article/details/8660291
Simple use of PHP mutable variables