homepage Welcome to WebmasterWorld Guest from 54.242.85.89
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Select from Database based on user select
LinusIT




msg:4286042
 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.

 

jbroder




msg:4286482
 8:58 pm on Mar 23, 2011 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved