簡體   English   中英

在 PHP 中選擇默認選項下拉列表

[英]Select a default option dropdown list in PHP

這是我的代碼:

<?php
$PricerrTheme_enable_dropdown_values    = get_option('PricerrTheme_enable_dropdown_values');
                            $PricerrTheme_enable_free_input_box     = get_option('PricerrTheme_enable_free_input_box');
                            $x = (isset($_POST['job_cost']) ? $_POST['job_cost'] : $_SESSION['job_cost']);
echo PricerrTheme_get_variale_cost_dropdown('do_input', $x);
?>

Q:選項是從db中選擇的,是$1,$2,$3,$4,$5等定價集。如何默認選擇$5選項而不是當前默認的最低$1選項?

使用selected="selected" <option selected>這也類似於selected="selected"

    <option selected="selected">
       $5
    </option>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM