本文介绍了发布下拉框的选定项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<form class="clearfix" action="reg_account.php" method="post">
<div class="clearfix" style="padding-removed 34%;">
<input type="text" class="small-text" placeholder="User Name" name="name">
</div>
<div class="clearfix" style="padding-removed 34%; padding-removed 2px;">
<input type="text" class="small-text" placeholder="Registration ID" name="id">
</div>
<div class="clearfix" style="padding-removed 34%; padding-removed 2px;">
<input type="text" class="small-text" placeholder="Password" name="password">
</div>
<div class="clearfix" style="padding-removed 34%; padding-removed 2px;">
<input type="text" class="small-text" placeholder="Reference" name="reference">
</div>
<div class="clearfix" style="padding-removed 34%; padding-removed 2px;">
<input type="text" class="small-text" placeholder="Placement ID" name="placementid">
</div>
<br>
<div class="clearfix" style="padding-removed 34%;">
<select id="eproducts" name="cscf[producttype]" style="color: blue; width: 310px; text-align: center; background-color:captiontext">
<!-- <option>------ Select Products ------</option>-->
<?php echo "<option>---------------- Select Products ----------------</option>"; ?>
<?php
$query = "SELECT sl, types from `products`";
$result = mysql_query($query) or die($query . "<br/><br/>" . mysql_error());
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['id'] . "'>" . $row['types'] . "</option>";
}
?>
</select>
<input type="text" name="producttype" id="product_hidden">
</div>
<input type="submit" class="btn green" value="Registration">
</form>
<script>
$(document).ready(function() {
$("#eproducts").change(function(){
$("#product_hidden").val(("#eproducts").find(":selected").text());
});
});
</script>
推荐答案
这篇关于发布下拉框的选定项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!