我正在使用季度报告,我可以选择我想要显示的季度。如果我选择第二季度,那么它将显示。 问题是,我希望我的报告具体。例如。我有一个下拉菜单,您可以选择一年。 之后,如果我选择2011,在我选择之后,那么现在我可以选择2011年的第1季度,第2季度,第3季度或第4季度......我该怎么做? 这是我的代码。
<html>
Select Year: <select name="sortyear" id="sortyear">
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
<input type = "submit" name = "submit" value = "Select">
</form>
Select year:
<select name="quarter" id="quarter">
<option value="1">1st Quarter</option>
<option value="2">2nd Quarter</option>
<option value="3">3rd Quarter</option>
<option value="4">4th Quarter</option>
</select>
<input type="submit" name="submit" value="Go">
<?
if($_POST)
{
$result=mysql_query("SELECT enrollee_info.*, payments.* FROM enrollee_info INNER JOIN payments ON payments.enrollee_id = enrollee_info.e_id WHERE payments.payment_status='Paid' AND QUARTER(payments.entrydate)='".$quarter."'");
?>
</form>
答案 0 :(得分:0)
首先,这一点HTML不正确(不能在表单中包含表单):
<form action="" id="userLocation" method="post">
<form name="sample" method="POST">
<form method="post" id="category" name="category">
Select Year: <select name="sortyear" id="sortyear">
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
<input type = "submit" name = "submit" value = "Select">
</form>
Select year:
<select name="quarter" id="quarter">
<option value="1">1st Quarter</option>
<option value="2">2nd Quarter</option>
<option value="3">3rd Quarter</option>
<option value="4">4th Quarter</option>
</select>
<input type="submit" name="submit" value="Go">
您应该拥有以下内容:
<form action="some URL" method="POST">
Select Year: <select name="sortyear" id="sortyear">
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
Select Quater:
<select name="quarter" id="quarter">
<option value="1">1st Quarter</option>
<option value="2">2nd Quarter</option>
<option value="3">3rd Quarter</option>
<option value="4">4th Quarter</option>
</select>
<input type="submit" name="submit" value="Go">
</form>