Home  >  Article  >  Backend Development  >  8 tips commonly used in PHP development_PHP tutorial

8 tips commonly used in PHP development_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:49:47680browse

PHP batch gets the value of checkbox

1. Name


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 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)";
}

PHP determines whether the Form is submitted

$action=$HTTP_POST_VARS["Button1"];
if($action=="Submit")
{
//Perform form operation
}
else
{
//Read the default value
}

PHP Get the string length

strlen($myrow[1])

PHP Url redirect

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 method="get", use $_GET["test"] Replace $test
If method="post", use $_POST["test"] instead of $test

PHP gets the current IP



PHP Get the 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/319448.htmlTechArticlePHP batch gets the value of checkbox 1. Naming input type='checkbox' name='checkbox[]' value =$dwmyrow[banzhu] / 2. Use when the plan is used as part of the sql instruction: If the words involved in the control...
Statement:
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