mysql_fetch_array issue

kisas

New Member
Here is the code:\[code\]<select name="op1" id="op1" class="op1"> <option value=""> -- please choose -- </option> <?php while($row = mysql_fetch_array($query)){ $id = $row['id']; $name = $row['name']; echo '<option value="'.$id.'">'.$name.'</option>'; } ?></select><br /><select name="op2" id="op2" style="margin-top:20px" class="op2"> <option value=""> -- please choose -- </option> <?php $query2 = mysql_query("SELECT * FROM cat2 WHERE cor = '$id' ORDER BY id ASC"); while($row2 = mysql_fetch_array($query2)){ $id2 = $row2['id']; $name2 = $row2['name']; echo '<option value="'.$id2.'">'.$name2.'</option>'; } ?></select>\[/code\]What I want to do is select $id from the first loop and use it in the second loops query but cant seem to get it to work because of the variable pipeline, does anyone know a work around for this?
 
Back
Top