PHP Implementation page Transfer value $_get example

Source: Internet
Author: User

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> ";}
? > 

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.