A PHP program handles the Get and post methods of Web Forms in addition to the usage _php tutorial

Source: Internet
Author: User

Sometimes we need to keep the get and post parameters on the next page or on other uses!
The convenience of work so I wrote this code!
I hope you have a lot of communication!

/*
Program Design: Lin Jianxui (Maple design Room)
Made in Zhuhai by 2007-03-24
qq:5818500
Email:linzhenxuan@163.com
Do not delete this copyright information
Purpose: Preserve and modify get and Post parameters
*/
function Getplus ($x =, $value =, $plus =close, $method =all) {
Global $_get,$_post;
$array = Array ();
if ($method ==all) {
$array [] = $_get; $array [] = $_post;}
ElseIf ($method ==get) {$array [] = $_get;}
ElseIf ($method ==post) {$array [] = $_post;}
$a = $_get;
$i = 1;
$true = 0;
foreach ($array as $k = = $a) {
foreach ($a as $b = = $c) {
if ($b = = $x) {
$c = $value;
$true = 1;//found.
$true 2 = 1;
}
if ($plus ==close) {
if ($i ==1) {
$temp. = "? $b = $c";
}else{
$temp. = "& $b = $c";
}
}else{
if ($i ==1) {
if ($true 2!=1) {$temp. = "? $b = $c";} else{$temp. = "?"; Unset ($true 2);}
}else{
if ($true 2!=1) {$temp. = "& $b = $c";} Else{unset ($true 2);}
}
}
$i + +;
}
}
if ($true ==0) {
if (Strpos ($temp, "?") >0 | | Strpos ($temp, "=") >0) {
$temp. = "& $x = $value";
}else{
$temp. = "? $x = $value";
}
}
ElseIf ($true ==1 && $plus!=close) {
if (Strpos ($temp, "?") >0 | | Strpos ($temp, "=") >0) {
$temp. = "& $x = $value";
}else{
$temp. = "? $x = $value";
}
}
return $temp;
}
?>

Like the original
GET:? method=1&a=1&b=2
post:y=2007&m=03
Used a

Then show
? method=1&a=1&b=2&y=2007&m=03&c=3
Used a

Then show
? method=1&b=2&y=2007&m=03&a=3
Dragged the a=3 to the last side.
I used it to combine with JavaScript.
Previous page
I feel very good!
There may be a bug to write not found it!
I hope you will mention a lot!

http://www.bkjia.com/PHPjc/508239.html www.bkjia.com true http://www.bkjia.com/PHPjc/508239.html techarticle Sometimes we need to keep the get and post parameters on the next page or on other uses! The convenience of work so I wrote this code! I hope you have a lot of communication!? /* Program Design ...

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