View Single Post
Old 02-19-2009, 08:14 PM   #1
Join Date: Feb 2009
Posts: 3
Default Creating Dynamic Dropdowns Tut Error

Having a problem with the selecting the make. I think it has to do with my java code but can't figure it out. The error shows:
Notice: Undefined index: make in C:\Documents and Settings\ryan\My Documents\Web Root\Test\dropdown.php on line 4

The make selection won't stay selected but the model section changes when you select the make. Anyone catch what I have wrong?


PHP Code:
$make    =    $_POST['make'];
if (
$query    sprintf("SELECT * FROM car_model where car_model_id='$make'");
$result    = @mysql_query($query);
$rowModel    mysql_fetch_array($result);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<form id="form1" name="form1" method="post" action="dropdown.php">
  <select name="make" onChange="document.forms[0].submit()">
    <option value="" selected>Select Make</option>
    <option value="1">Alfa Romero</option>
    <option value="2">Audi</option>
    <option value="3">BMW</option>
    <option value="4">Citroen</option>
   <select name="model">
    <option value="">Select Model</option>
    <?php do {     ?>
    <option value="<?php echo $rowModel['car_model_id']; ?>"><?php echo $rowModel['car_model']; ?></option>
    <?php    }while ($rowModel mysql_fetch_array($result)); ?>

Last edited by davidj; 02-19-2009 at 08:57 PM..
inflict is offline   Reply With Quote