example, single form content sending and receiving
We all want to implement content sending or receiving we first need a form, which is the form tag, which is the front end HTML code.
| The code is as follows |
Copy Code |
|
<form action= "1.php" >
<p>get Send mode:
<input type= "text" name= "WZ"/></p>
<p>post Send send:
<input type= "text" name= "WZ1"/></p>
<input type= "Submit" value= "OK"/>
</form> |
PHP in the background to get what you need from the value in the name above
| The code is as follows |
Copy Code |
|
<?php
$a = $_get [' wz '];
if ($a ==null) {echo "The other side did not enter." </br> ";} else{
echo "I am a Get receive way:". $a. " </br> ";}
$b = $_get [' wz1 '];
if ($b ==null) {echo "The other side did not enter." </br> ";} else{
echo "I am the Post receive method:". $b. " </br> ";}
?> |
The PHP meaning here is to get the value in the attribute name inside the tag
However, echo in PHP is printed out if it is to be judged first ~ Note: If the form is a post pass value We must use $_post to accept the data
example, URL pass value
This is the PHP code to send
| The code is as follows |
Copy Code |
|
<?php
Include_once (' zq/db.php ');
$sql = "SELECT * from Wd_sql";
$query =mysql_query ($sql);
$i = 1;
while ($result = Mysql_fetch_array ($query)) {
$x = $i + +;
"<br><a href= ' del.php?xx=". $result [' id ']. " &ccxc=wd_sql ' > Delete </a> '//here implements the value transfer
}
?> |
This is the PHP that receives the value
| code is as follows |
copy code |
|
<?php
$uid = $_get[' xx '];
$db _sql = $_get[' CCXC '];
if (mysql_query ($sql) = = 1)
{echo <script>alert (' delete succeeded! '); History.go ( -1);</script> ";}
? > |