PHP retrieves checkbox values in batches
1. Name
<Input type = 'checkbox' name = 'checkbox [] 'value = $ dwmyrow [Banzhu]/>
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
<? PHP
$ 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
<? = $ Http_server_vars ["remote_addr"]?>
PHP gets the current time
<? PHP
Echo date ("Y-m-d G: I: s ");
?>
Date ("Y, M, D ")
Date ("Y-n-J ")