从select option标签定义要创建的数据库

时间:2015-09-16 08:03:22

标签: php html

html表单操作属性=" uploadone.php"。表单有一个选项元素值属性='红色'。以这种方式创建了许多数据库。我可以像下面一样向URL添加参数,但由于选择很长,所以它太麻烦了。在这种情况下,什么是最好的解决方案。请帮忙。先谢谢

 <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 个答案:

答案 0 :(得分:0)

你应该得到值,因为你的表单有post方法属性。 如

$_POST['unone']

而不是

$_GET['name']

并更改表单的操作为uploadone.php