Tips for daily PHP development

Source: Internet
Author: User
Tags php form

PHP batch obtains the maximum checkbox Value
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 ")

Related Article

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.