2015-10-24 60 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 
} 

現在你有了價值。請注意,這不會給你國家的完整名稱。例如,你選擇了美國,它會給你美國。