Different usage of Get and Post methods for PHP program processing Web Forms

Source: Internet
Author: User
Tags foreach

Sometimes we need to keep get and post parameters passed on the next page or other uses!

The convenience of work so I wrote this code!

I hope we can communicate a lot!

?
/*
Program Design: Lin Jianxui (fluttering maple design room)
Made in Zhuhai by 2007-03-24
qq:5818500
Email:linzhenxuan@163.com
Do not delete this copyright information
Purpose: Keep 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 it.
$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;
}
?>

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.