How can I fail to obtain the value when submitting php to form? Excuse me

Source: Internet
Author: User
Why can't php get the value after submitting it to form? Consult & lt; formaction = & quot; article_validate.php & quot; method = & quot; post & quot; & gt; & nbsp; & lt; ul & gt; how can I fail to obtain the value when php is submitted to form? Consult



Error_reporting (0 );
Include ("ky_database/cls_mysql.php ");
If ($ _ POST ['keyword']! = ""){
$ SQL = "select * from ky_number where number = '$ keyword '";
Echo $ keywords; $ rs = mysql_query ($ SQL );
$ A = mysql_num_rows ($ rs );
If ($ a> 0 ){
Echo "this product is genuine ";
} Else {
Echo "this product is not genuine! ";
}
}
?>

------ Solution --------------------
Change $ keywords to $ _ POST ['keyword'];
------ Solution --------------------
PHP code
$ Key = $ _ POST ['keyword']; echo $ key;
------ Solution --------------------
No value is assigned to $ keywords in number = '$ keyword'.

$ Key = $ _ POST ['keyword'];

------ Solution --------------------



Error_reporting (0 );
Include ("ky_database/cls_mysql.php ");
$ Keywords = $ _ POST ['keyword'];
If (! $ Keywords = ""){
$ SQL = "select * from ky_number where number = $ keywords ";
Echo $ keywords; $ rs = mysql_query ($ SQL );
$ A = mysql_num_rows ($ rs );
If ($ a> 0 ){
Echo "this product is genuine ";
} Else {
Echo "this product is not genuine! ";
}
}
?>
------ Solution --------------------
Solution on the 4th floor
------ Solution --------------------
In the latest php version, global variables are placed in several global arrays.
To use
PHP Super global variable
$ GLOBALS
Contains a reference to a variable that is valid globally for each current script. The key name of the array is the name of the global variable. $ GLOBALS array exists from PHP 3.

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.