所以这就像我有一个选择框,用while循环作为选项,因为我想从数据库中带出选项,是否可以点击该选项并链接?选择框Onchange:autosubmit()选项与PHP
while循环是这样
while ($row = mysqli_fetch_assoc($result0))
{
$option .= '<option value="'.$row['id'].'">'.$row['Font_Family'].'</option>';
}
这是选择框
<select id='font' style="width:100px;" onchange="autosubmit();">
<option value ="0">Select</option>
但在点击选项,我想将它链接到
font.php?id={id that is being pointed to}
我该怎么做?
使用Javascript并创建'autosubmit'功能。一个简单的window.location更改为getElementById('font')。值将使您开始。 – JClaspill
select元素不是链接,您需要使用javascript,甚至在javascript中也会出现点击处理程序选项的问题,您应该将某些内容绑定到select的更改事件。 – adeneo