【问题标题】:BootStrap form Helper Country PickerBootStrap 表单 Helper Country Picker
【发布时间】:2015-10-24 19:10:49
【问题描述】:

我正在使用引导表单助手在 php 中制作表单。一切正常但我无法在 php 表单字段中获取国家/地区名称。 country 字段使用 bootstrapformhelper 进行样式设置,并且它被包裹在 div 中,而不是输入标签。

这里是代码。

if(isset($_POST['country'])){
    $country= $_POST['country'];
    echo $country;
}
?>

<form action="rough.php" method="post">

    <div id="country"class="col-sm-8 bfh-selectbox bfh-countries" data-country="NG" data-flags="true">  
    </div>
    <input type="submit" value="submit">
</form>

如何获取 php 的值?

【问题讨论】:

    标签: twitter-bootstrap


    【解决方案1】:
    <div id="country"class="col-sm-8 bfh-selectbox bfh-countries" data-country="NG" data-name="country" data-flags="true">  
    </div>
    

    你需要先有一个名字。

    if(isset($_POST["submit"])) {
    $country= $_POST['country']; 
    //INSERT QUERY HERE
    }
    

    现在你有了价值。请注意,这不会为您提供国家/地区的完整名称。例如,你选择了美国,它会给你美国。

    【讨论】:

    • 感谢您的解决方案,但如果我需要获取国家/地区的全部价值怎么办?例如,我选择了“美国”,我希望提交的值与“美国”完全一样,而不仅仅是“美国”?
    【解决方案2】:

    在国家/地区试试这个

    <div class="col-sm-8">
    <select class="input-medium form-control bfh-countries" data-country="US"></select>
    </div>
    

    【讨论】:

    • 欢迎来到 StackOverflow!请考虑解释为什么您的答案可以解决问题。
    猜你喜欢
    • 2015-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 2021-09-06
    相关资源
    最近更新 更多