在我的剧本中,我有以下内容: -
<script>
$("#country").on("change", function(){
var selected = $(this).val();
$("#results").html("<div class='alert-box success'><span><img src='images/shipping_ukrm.jpg'></span> <b>£" + selected + " plus Packaging</b></div>");
$('#frmelement').val(selected);
})
</script>
&#13;
我选择的国家/地区又在下拉选择字段中获取选项值的值,但我想将下拉值(即国家/地区名称)存储在变量中以传递并在表单中使用
任何帮助
这是选择下拉框信息
echo '<select name="country" id="country" class="span5" />';
echo '<option value="0" selected>Select Country</option>';
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql1 = "SELECT c.country_id,c.name,pr.price,pr.weight,pr.weight1,pr.class,c.Zone FROM country as c LEFT JOIN postagerates as pr ON pr.class = c.Zone WHERE (pr.weight <= '$totweight' AND pr.weight1 >= '$totweight') ORDER BY c.name ASC";
$query1 = mysql_query($sql1);
while ($row2 = mysql_fetch_array($query1)) {
echo '<option value = "'.money_format('%.2n', $row2["price"]).'">'.$row2["name"].'</option>';
}
echo '</select>
&#13;
答案 0 :(得分:1)
答案 1 :(得分:0)
这是代码:
echo '<select name="country" id="country" />';
echo '<option value="0" selected>Select Country</option>';
echo '<option value = "'.money_format('%.2n', $row2["price"]).'">'.$row2["monday"].'</option>';
}
echo '</select>