0

我想要做的是从选择列表中选择值并在 href 调用中使用它,这是一个示例:

 $query="SELECT distinct(loca_cod) as id, localidad as nombre FROM $tabla WHERE     parti_cod='$stateId' order by nombre asc";
$result=mysql_query($query);

?>
<div class="styled-select">
<select name="city">
<option>Seleccione Localidad</option>
<? while($row=mysql_fetch_array($result)) { ?>
<option value = "<?=$row['id']?>"><?=$row['nombre']?></option>
<? } ?>
</select>
</div>
<br />
</tr>
<tr><td>&nbsp;</td><td></td></tr>
<tr>
<td><a href="step2.php?uch=HERE GOES THE VALUE SELECTED FROM USER class="boton_res">Continue</a></td>
</tr>

关于如何进行的任何提示?谢谢!

4

1 回答 1

0

尝试使用 do while

<option>Seleccione Localidad</option>
<? do {?>
<option value = "<?=$row['id']?>"><?=$row['nombre']?></option>
<? } while($row=mysql_fetch_array($result)) ; ?>
</select>
</div>
<br />
</tr>
<tr><td>&nbsp;</td><td></td></tr>
<tr>
<td><a href="step2.php?uch=HERE GOES THE VALUE SELECTED FROM USER class="boton_res">Continue</a></td>
</tr>
于 2012-09-11T21:54:02.060 回答