我正在使用下面的代码从URL中获取paramteres。将变量值传递给URL
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" role="search">
<select name="seme" id="seme">
<option value="sem1">Semester-1</option>
<option value="sem2">Semester-2</option>
<option value="sem3">Semester-3</option>
<option value="sem4">Semester-4</option>
</select>
<input type="text" name="find" id="find" placeholder="Enter worksheet/file name..." />
<button type="submit" class="btn btn-theme">Search</button>
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// collect value of input field
$name = $_REQUEST['find'];
$sem = $_REQUEST['seme'];
if (empty($name)) {
echo "Name is empty";
} else {
echo $name; echo $seme;
}
}
?>
但问题是,我只得到文本。我想为d我应该做的就是选择框的值的价值?或我缺乏什么?
谢谢!
你怎么知道你没有得到的选择框值?你有回应吗? – Ahmad 2014-11-22 11:57:05
感谢您的问题!解决了 :) – Twix 2014-11-22 11:58:45