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