I've been trying to fix this code but I couldn't.
if ($_POST['number']) {
$number = $_POST['number'开发者_如何学编程];
$code = $_POST['code']; // I INSERTED THIS HERE TO GET THE DROPDOWN LIST VALUE
//-connect to the database
$db = mysql_connect(SERVER, USERNAME, PASSWORD) or die('cannot connect to the database because: '.mysql_error());
//-select the database to use
$mydb = mysql_select_db(DATABASE);
//-query the database table
$sql = "SELECT * FROM carmdi WHERE ActualNB LIKE '%".$number."%' AND CodeDesc LIKE '%".$code."%'";
//-run the query against the mysql query function
$result = mysql_query($sql);
This is not the full code, but I inserted $code=$_POST['code'];
but it shows a white page, but when I use this instead $code="g";
It works fine, I don't know why it's not working from the dropdown menu.
can you help me please with this ? thankscheck if $_POST['code'] is set or not
what does $_POST['code'] contains? tried to var_dump it?
by the way
if ($number = $_POST['number'] && $code = $_POST['code']) {
looks much nicer ;)
精彩评论