cyandi_man Posted November 2, 2006 Share Posted November 2, 2006 I recently posted an error in my SQL site that has now made some progress. I now know that the problem lies within the query line itself when pulling data from the SQL database. this message may seem lengthy but it only looks that way because i am explainignin detail to avoid confusion of what i am asking. The following code displays a dropdown menu containing data that the user must choose from:$dealerName = "$dealerName"; //input by user $query = "SELECT * FROM truckhoods"; $result = mysql_query($query) or die ("Couldn't execute query."); /* Display results in a dropdown*/ echo "<b>$dealerName</b>"; echo "<form action='javascript: gethoodmodel()'> <select name='productName'>\n"; while ($row = mysql_fetch_array($result)) { extract($row); echo "<option value='$productName'>$productName\n"; } echo "</select>\n"; echo "<input type='submit' value='View Model'> </form>\n";?>the above version works and can be seen at: www.offsettruckhoodsandbumpers.com/TRUETEST3(all files are not uploaded so please simply click on the "truckhoods" button in the top nav and pick a dealer name from the top dropdown menu on the right side panel.) YOu will notice that another dropdown list appears and populates with ALL dealer numbers. This is because of the query: [b]"SELECT * FROM truckhoods";[/b] in the coding above. The main idea here is to select only the items related to the PARTICULAR dealer choosen from the first dropdown menu. I used the line of query below - when simply using a post method in which a blank page with the dropdown takes you to another blank page with the last dropdown and then finally the last page with the data. (in other words using the php files on there own with a post method instead of the includes that target a particular window within the site:[b]"SELECT * FROM truckhoods WHERE dealerName='$dealerName";[/b]this line works when the php code is used by itself but not when within my site ...why? is there another line of code needed to transfer info from one dropdown menu to the other so only the specific information is populated in the list?Please help as i am soooo close to finishing this portion of the site! anyone's help would be greatly appreciated! Quote Link to comment Share on other sites More sharing options...
fenway Posted November 2, 2006 Share Posted November 2, 2006 Well, I see unpaired single quotes... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.