$ _GET未定义索引单选按钮

时间:2016-08-15 07:55:10

标签: php html mysql

使用单选按钮进行ORDER BY列表,然后提交。

我坚持使用此代码,它在我提交时工作正常,但每当我检查并提交待处理单选按钮时,都会出现错误消息未定义索引。 $ limit变量只是每页列表的限制。

PHP

$limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;
$sql = "SELECT * FROM v_tickets_information";
if (!isset($_GET['filter'])) {

if ($_GET['filter'] == 'old') {
    $sql .= " ORDER BY Date_Time ASC $limit";
} elseif ($_GET['filter'] == 'latest') {
    $sql .= " ORDER BY Date_Time DESC $limit";
} elseif ($_GET['stats'] == 'pending') {
    $sql .= " WHERE TicketStatus = 'Pending' ORDER BY Date_Time DESC $limit";
} 
}

HTML

<form>
<input type="radio" name="filter" value="latest"> Latest to old<br>
<input type="radio" name="filter" value="old"> Old to latest<br>


<hr>    

<input type="radio" name="stats" value="new"> New<br>
<input type="radio" name="stats" value="pending"> Pending<br>
<input type="radio" name="stats" value="open"> Open<br>
<input type="radio" name="stats" value="closed"> Closed


<div class="form-group">
<label for="dept"><h2>Department</h2></label>
<select class="form-control" id="dept" name="dept">
<option>All</option>
<option>Accounting</option>
<option>Admin Office</option>
<option>Customer Service</option>
<option>SLI</option>
<option>HRD</option>
<option>Engineering Office</option>
<option>Production</option>
<option>Accounting</option>
<option>IMPEX</option>
<option>MIS</option>

</select><br>
<div class="col-md-9">
  <input type="submit" name="Submit" value="Sort" class="btn pull-left"     />
</div>
</div>
 </form>

顺便说一句,我没有为部门创建代码php因为我得到早期错误我必须先解决这个问题。请帮我解决这个问题。继承人截图。 screenshot image

0 个答案:

没有答案