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; & nbsp; & lt; li & gt; & how can I fail to get the value when php submits it 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.