2015-09-16 101 views
-1

html表單動作屬性=「uploadone.php」。該表單具有選項元素值attribute ='Red'。有許多數據庫可以這種方式創建。我可以像下面那樣向URL添加參數,但由於select非常長,所以過於繁瑣。這種情況下最好的解決方案是什麼?請任何幫助。由於前期從選擇選項標籤定義要創建的數據庫

<form action="uploadone.php" method="post"     
enctype="multipart/form-data"> 

<select name="unoone" class="unoone ui-btn ui-mini" data-role="none"  data-native-menu="false" required> 
    <option value="">My Task</option> 
    <option option value="Red">Red</option> 
    <option option value="Blue">Blue</option> 
    <option option value="Black">Black</option> 
    <option option value="White">White</option>  

<input type="submit" value="Submit" name="submit" /> 
    </form> 

uploadone.php

include 'Includes/conDB.php'; 

// 'Red' the option element value attribute 
// Select a database to use 
// T1 and T2 have a LEFT JOIN 

if ($_POST['unoone'] == 'Red') { 

include "Includes/T1.php"; 
include "Includes/T2.php"; 

} 
+1

'動作= 「uploadone.php?NAME = '紅'」'有什麼用額外的引號?取而代之的是做'action =「uploadone.php?name = Red」'。 – Repox

回答

0

你應該得到的值,因爲在窗體中有POST方法屬性。 作爲

$_POST['unone'] 

,而不是

$_GET['name'] 

和改變形式的作用是作爲uploadone.php

+0

深深感謝Rohit!它是藍天的場景 – Marc