-3

我正在处理季度报告,我可以选择要显示的季度。如果我选择第二季度,那么它将显示。问题是,我希望我的报告具体。例如。我有一个下拉列表,您可以选择一年。之后,如果我选择 2011,在我选择它之后,现在我可以选择 2011 年的第一、二、三或四季度。我应该怎么做?这是我的代码。

<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>
4

1 回答 1

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>
于 2013-03-09T13:29:13.793 回答