1
使用我想生成包含从下拉菜单中的值将被保存到一个PHP变量jQuery的获取值在PHP
<script>
$(document).ready(function()
{
/* we are assigning change event handler for select box */
\t /* it will run when selectbox options are changed */
\t $('#dropdown_selector').change(function()
\t {
\t \t /* setting currently changed option value to option variable */
\t \t var option = $(this).find('option:selected').val();
\t \t /* setting input box value to selected option value */
\t \t $('$showoption').val(option);
\t });
});
</script>
<?
mysql_query("Select unit_price From products where id= '" . $id_value . "'");
\t \t \t \t \t \t \t \t \t \t while ($row = mysql_fetch_array($qquery)){
\t \t \t \t \t \t \t \t \t \t \t $unit = $row['unit_price'];
\t \t \t \t \t \t \t \t \t \t }
?>
<select class="form-control" name="model" id="dropdown_selector" >
<option value="1">1001</option>
</select>
考虑把它放在一个表单中,然后提交该表单或使用后端调用另一个php文件与查询东西 – Alexander
我怎么能这样做 –
检出$ .ajax或document.formname.submit(); – Alexander