PHP - Querying and Displaying data from MYSql
Posted: Wed Jan 10, 2007 2:43 pm
Hi,
I should design a form that gets data from mysql dB, based on the user selection on the form, and display it on the same page. I facing a werd problem. All my values are becoming nulls once i hit the 'Query' button. So i commented all my code to get to the exact problem. Now, all i have is this:
As soon as i click the 'Query' button all the select boxes on the form gets defaulted to 'None' value (an option that is put in manually. All other options are queried from database.) all i get is:
Vendor: '' Model: '' Code: '' Target Date: ''
No matter what you select from the select box all i get is ''. Period.
Can anyone get me out of this weird problem? Actually, am i coding it right? Any help is appreciated. Thanks.
- Vamsi
and immediately as i [/b]
I should design a form that gets data from mysql dB, based on the user selection on the form, and display it on the same page. I facing a werd problem. All my values are becoming nulls once i hit the 'Query' button. So i commented all my code to get to the exact problem. Now, all i have is this:
- Variables to store the values from the user
Echos to display these values after clicking the 'Query' button.
The code for both is given below correspondingly.
Code: Select all
$name = mysql_real_escape_string($_POST['vendorname']);
$model = mysql_real_escape_string($_POST['productmodel']);
$code = mysql_real_escape_string($_POST['codename']);
$targ_date = mysql_real_escape_string($_POST['date']);Code: Select all
if ($_SERVER['REQUEST_METHOD'] == "POST")
{ echo "Vendor: '$name' \n";
echo "Model: '$model' \n";
echo "Code: '$code'"; echo "\n";
echo "Target DATE: '$targ_date'"; echo "\n";
}Vendor: '' Model: '' Code: '' Target Date: ''
No matter what you select from the select box all i get is ''. Period.
Can anyone get me out of this weird problem? Actually, am i coding it right? Any help is appreciated. Thanks.
- Vamsi
and immediately as i [/b]