Form submission method 1. GET: get: data format submitted by GET: $ _ GET [formelement] 2. POST: get the data format submitted by post: $ _ POST [formelement] 3. REQUEST method function: obtain the data format submitted in any way :... syntaxHighlig
Form submission method
1. GET Method
Function: get the data submitted in get mode.
Format: $ _ GET ["formelement"]
2. POST method
Function: obtains the data submitted in post mode.
Format: $ _ POST ["formelement"]
3. REQUEST method
Function: Obtain data submitted in any way
Format: $ _ REQUEST ["formelement"]
Check box, list box (the name is in the form of an array, such as: "select []", you can directly use $ _ POST ["select"] when getting its value) with example Sub:
Add page -- list box:
Receiving page:
# Echo $ _ POST ["selt"]
Print_r ($ _ POST ["selt"]);
?>
Check box: add page:
Receiving page:
# Echo $ _ POST ["username"];
# Echo $ _ GET ["username"];
# Echo $ _ REQUEST ["username"]
# Echo $ username;
// Echo $ _ POST ["chkval"];
Print_r ($ _ POST ["chkval"]);
?>
1. get the value in the text box: $ _ POST ["text"]
Here, you can check whether the magic switch is on (enabled by default). If not, you can use addslashes ($ _ POST ["text"]) to format it in HTML, the statement is as follows:
If (get_magic_quotes_gpc ())
{
// Enabled
Echo "enabled
";
Echo stripslashes ($ _ POST ["text"]);
}
Else
{
Echo addslashes ($ _ POST ["text"]);
}
2. file upload:
File upload code:
$ F = $ _ FILES ['Files'];
$ Dest_dir = 'uploads'; // sets the upload directory.
$ Dest = $ dest_dir. '/'. $ f ['name']; // Set the file name
$ R = move_uploaded_file ($ f ['tmp _ name'], $ dest );
# Chmod ($ dest, 0755); // sets the attributes of the uploaded file
Move_uploaded_file ($ file, $ destc)
Move the uploaded file to a new location
Upload_file.php
Upload. php
# Echo $ _ FILES ["fls"];
# Print_r ($ _ FILES ["fls"]);
// Echo $ _ FILES ["fls"] ["name"]; www.2cto.com
$ F = $ _ FILES ["fls"]; // obtain the value in the file box.
$ Dest_dir = "uploads"; // sets the upload directory.
$ Dest = $ dest_dir. "/". date ("ymdhji"). $ f ["name"]; // Set the file name
Move_uploaded_file ($ f ["tmp_name"], $ dest );
# Move_uploaded_file ()
?>
From hurry's column