Hi Guys,
I am still trying to get this solved, ran into another problem.
I am trying to autofill a dropdown list with data from the DB.
The list is being correctly filled, however when the page refreshes it isnt making the item I selected in the dropdown selected?PHP Code:<select name="collection1" OnChange="location.href=collection.collection1.options[selectedIndex].value">
<?php
if(isset($_POST['vehicle_type'])) {
echo "<option value=\"$_POST[vehicle_type]\">$_POST[vehicle_type]</option>";}
else {
echo "<option value=\"\">please select</option>";
}?>
<?
require_once ('../mysql_connect.php'); // Connect to the database.
// make the query to get the vehicle types
$query = "SELECT vehicle_type FROM vehicles";
// run the query
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result))
{
$vehicle_type=explode(',', $row['vehicle_type']);
for($i=0;$vehicle_type[$i];$i++)
{
echo "<option value=request-a-part-test3.php?vehicle_type=$vehicle_type[$i]>$vehicle_type[$i]</option>";
}}
echo "</select>";
?>
</select>
Can anyone possibly tell me what I have done wrong?PHP Code:
if(isset($_POST['vehicle_type'])) {
echo "<option value=\"$_POST[vehicle_type]\">$_POST[vehicle_type]</option>";}





Bookmarks