PHP Daily Development Tips

Source: Internet
Author: User

php Batch get checkbox value
1, named
<input type= ' checkbox '  name= ' checkbox[] '   value= $dwmyrow [banzhu] />
2, use
When a plan is treated as part of an SQL directive: if the field that participates in control is numeric,
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,
if (! empty ($_post[' checkbox '))  {
$expr  =  "'. Join (" ', ' ", & nbsp;$_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)
{
//Execute form Action
}
Else
{
//read default
}

php  Get string length
strlen ($myrow [1])

php url to
Header ("location: ". $_server[" Http_refereR "]);

PHP Hyper-Global Objects
<?php
$a  = 1;
$b  = 2;
Function sum ()
{
$GLOBALS ["B"] =  $GLOBALS ["A"]  $GLOBALS ["B"];
}
Sum ();
echo  $b;
?>

php  form Values
if  mothod= "get"   replace $ with  $_get["test"]  test 
If  mothod= "POST"   use  $_post["test"]  instead of $test

php to get current IP
<?= $HTTP _server_vars["remote_addr"]?>

php  get current time
<?php
Echo  date ("y-m-d g:i:s");
?>
Date ("Y year m month d days")
date  ("Y-n-j")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.