The PHP program uses the GET and POST methods to process web forms.

Source: Internet
Author: User
In addition to the GET and POST methods for processing web forms, the PHP program also reads the GET and POST methods for processing web forms, 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! Hope you can communicate more !? /* Program Design: Lin Jianxuan (floating maple design room) madein "> <LINKhref =" http

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

Shown later
? Method = 1 & a = 1 & B = 2 & y = 2007 & m = 03 & c = 3
Used

Shown later
? Method = 1 & B = 2 & y = 2007 & m = 03 & a = 3
Drag a = 3 to the end
I use Integration with javascript
Previous Page
I feel pretty good!
There may be bugs not found!
I hope you can mention it more!

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.