Welcome to WebmasterWorld Guest from 54.167.157.247

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Select from Database based on user select

   
12:08 am on Mar 23, 2011 (gmt 0)



I've got a contact form where users choose from two drop down menus, the values are purely numerical. When the user submits the form I'm trying to select more data using whatever option they have selected. In the email I am getting the number (id) but cannot retrieve the data I'm after.

Here's the select code:

//Vehicle Details
$getmakeqry = mysql_query("SELECT manufacturer_id, manufacturer_name FROM manufacturer WHERE manufacturer_id = '".$make."'") or die(mysql_error());;
$getmakerow = mysql_fetch_row($getmakeqry);
$getmakeresult = $getmakerow['manufacturer_name'];

$getmodelqry = mysql_query("SELECT model_id, model_name FROM model WHERE model_id = '".$model."'") or die(mysql_error());;
$getmodelrow = mysql_fetch_row($getmodelqry);
while($getmodelresult = mysql_fetch_row($getmodelrow))
{
$getmodel = $getmodelresult[1];
}


Here's the email body side of it:

$content = "$name has provided the following information:\n\n Email: $email\n Phone: $phone\n Make1: $make\n Make2: $getmakeresult\n Model1: $model\n Model2: $getmodel\n Message: $message\n\n--------------------------\n\n IP Address: $ip\n Referrer: $hr\n Host: $hst\n";


So make1 and model1 are working, they show the ID of whatever they've selected in the form but make2 and model2 show nothing.

Make & Model are populate using the following:


$make = $_POST['request_make'];
$model = $_POST['request_model'];

$make = stripslashes(strip_tags(trim($make)));
$model = stripslashes(strip_tags(trim($model)));


You'll probably notice I've different things in getting it to work but I'm stuck for ideas now.

Any help would be great.
8:58 pm on Mar 23, 2011 (gmt 0)

5+ Year Member



the code you show is all code for make1 and model1. If you show the make2 and model2 code, maybe someone can help you.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month