Home > Backend Development > PHP Tutorial > PHP Tips_PHP Tutorial

PHP Tips_PHP Tutorial

WBOY
Release: 2016-07-13 10:31:42
Original
811 people have browsed it

Get checkbox values ​​in batches with PHP

1. Naming



2. Use

When the plan is used as part of the sql instruction: if the fields participating in the control are numerical, then

if(!empty(_POST[’checkbox’])) {
expr = join(",", _POST[’checkbox’]);
sql = "select * from tbl_name where field in (expr)";
}

If the field participating in the control is numeric, then

if(!empty(_POST[’checkbox’])) {
expr = "’".join("',’", _POST[’checkbox’]).".";
sql = "select * from tbl_name where field in (expr)";
}

PHP determines whether the Form form is submitted

action=HTTP_POST_VARS["Button1"];
if(action=="submit")
{
//Perform form operations
}
else
{
//Read default value
}

PHP Get string length

strlen(myrow[1])

PHP Url redirect

Header("Location: "._SERVER["HTTP_REFERER"]);

PHP superglobal object

a = 1;
b = 2;
function Sum()
{
GLOBALS["b"] = GLOBALS["a"] + GLOBALS["b"];
}
Sum();
echo b;
?>

PHP form value

If method="get", use _GET["test"] instead of test
If method="post" use _POST["test"] instead of test

PHP gets current IP



PHP Get current time

echo date("Y-m-d G:i:s");
?>
date("Y year m month d day")
Date ("Y-n-j")

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/762022.htmlTechArticlePHP obtains the checkbox value in batches 1. Name inputtype=checkboxname=checkbox[]value=dwmyrow[banzhu]/ 2 , use when the plan is used as part of the sql instruction: If the field participating in the control is a number...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template