2015-10-24 54 views
0

我使用引导形式帮助器在PHP中创建表单。一切工作正常但我无法在php表单字段中获取国家/地区名称。国家/地区字段使用bootstrapformhelper进行样式设置,并使用div封装而不是输入标签。BootStrap形式助手国家选择器

这是代码。

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的值?

回答

0

尝试一下本作国家

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

欢迎来到StackOverflow!请考虑解释为什么你的答案解决了这个问题。 – David

2
<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 
} 

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