如何从下拉列表中获得选定的用户名是URL的var


how to get selected username from dropdown list to be the var for URL

如何让所选变量显示在URL中<select>

我的代码是:
print "<select name='"assignedby'" multiple size='"10'">";
while ($data = dbResult($qh)) {
        print "<option name='"$data[name]'"";
        print ">$data[name]</option>'n";
}
print "</select>";
print "<br><a href='".$_SERVER['PHP_SELF']."?action=add'>Add</a> || <a href='".$_SERVER['PHP_SELF']."?origname=$data[name]'>Edit</a>'n";

当有人点击"编辑"链接时,它显示为:http://www.site.com?origname=我想让它与下拉列表中实际选中的origin一起显示。如:http://www.site.com?origname=美元selecteduser-fromdroplist

请帮忙!

为什么不直接使用form method = get呢?

<form id="select_name" action="" method="get">
    <select name="origname">
    <?php while ($data = dbResult($qh)): ?>
        <option value="<?php echo $data[name]; ?>"><?php echo $data[name]; ?></option>
    <?php endwhile; ?>
    </select>
    <a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=add">Add</a> || <input type="submit" name="submit" value="Edit">
</form>

但至于为什么你的代码不工作,你调用$data[name']项目外的while循环