Sometimes we need to keep the GET and POST parameters transmitted on the next page or for other purposes!
At work, I wrote such code!
I hope you will have more exchanges!
<?
/*
Program Design: Lin Jianxuan (floating maple design room)
Made in Zhuhai by 2007-03-24
QQ: 5818500
Email: linzhenxuan@163.com
Do not delete this copyright information
Purpose: retain and modify the 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 => $ ){
Foreach ($ a as $ B => $ c ){
If ($ B = $ x ){
$ C = $ value;
$ True = 1; // found
$ True2 = 1;
}
If ($ plus = close ){
If ($ I = 1 ){
$ Temp. = "? $ B = $ c ";
} Else {
$ Temp. = "& $ B = $ c ";
}
} Else {
If ($ I = 1 ){
If ($ true2! = 1) {$ temp. = "? $ B = $ c ";} else {$ temp. = "? "; Unset ($ true2 );}
} Else {
If ($ true2! = 1) {$ temp. = "& $ B = $ c";} else {unset ($ true2 );}
}
}
$ 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;
}
?>
For example
GET :? Method = 1 & a = 1 & B = 2
POST: y = 2007 & m = 03
Used
<? = Getplus (c, 3)?>
Shown later
? Method = 1 & a = 1 & B = 2 & y = 2007 & m = 03 & c = 3
Used
<? = Getplus (a, 3, open)?>
Shown later
? Method = 1 & B = 2 & y = 2007 & m = 03 & a = 3
Drag a = 3 to the end
I used <? = Getplus (a, open)?> Integration with javascript
Previous Page
I feel pretty good!
There may be bugs not found!
I hope you can mention it more!