8 tips commonly used in PHP dynamic website development. Read the 8 tips commonly used in PHP dynamic website development. This article summarizes the 8 tips commonly used in PHP daily development. PHP batch get the checkbox value 1, named inputtype = "> <LINKhref =" http://www.php100.com//statics/style/headfloor_950
This article summarizes eight tips commonly used in daily PHP development.
PHP batch obtains the maximum checkbox value
1. name
2. use
When the plan is considered as part of an SQL command: If the field involved in the control is numeric
If (! Empty ($ _ POST ['checkbox']) {
$ Expr = join (",", $ _ POST ['checkbox']);
$ SQL = "select * from tbl_name where field in ($ expr )";
}
If the field involved in the control is numeric
If (! Empty ($ _ POST ['checkbox']) {
$ Expr = "'". join ("', '", $ _ POST ['checkbox']). ".";
$ SQL = "select * from tbl_name where field in ($ expr )";
}
PHP checks whether the Form is submitted
$ Action = $ HTTP_POST_VARS ["Button1"];
If ($ action = "submit ")
{
// Execute the form operation
}
Else
{
// Read the default value
}
PHP obtains the string length
Strlen ($ myrow [1])
PHP Url redirection
Header ("Location:". $ _ SERVER ["HTTP_REFERER"]);
PHP Super global object
$ A = 1;
$ B = 2;
Function Sum ()
{
$ GLOBALS ["B"] = $ GLOBALS ["a"] + $ GLOBALS ["B"];
}
Sum ();
Echo $ B;
?>
PHP form value
If mothod = "get", replace $ _ GET ["test"] with $ test.
If mothod = "post", replace $ _ POST ["test"] with $ test.
PHP obtains the current IP address
PHP gets the current time
Echo date ("Y-m-d G: I: s ");
?>
Date ("Y, m, d ")
Date ("Y-n-j ")