• Hi all,

    I wrote a custom plugin with multiple pages (using &page=1, etc). Here’s my form code on “/wp-admin/admin.php?page=myplugin&upload=1”:

    <form enctype="multipart/form-data" action="/wp-admin/admin.php?page=myplugin&upload=2" method="post">
    Select Location: <select name="location">
        <option>Select Location</option>
        <option value="N">North</option>
        <option value="S">South</option>
        <option value="E">East</option>
        <option value="W">West</option>
    </select><br />
    Upload File: <input name="ufile" type="file" id="ufile" size="50" /><br />
    <b><u>Sunday</u></b> Date: <select name="month">
        <option> - Month - </option>
        <option value="01">January</option>
        <option value="02">Febuary</option>
        <option value="03">March</option>
        <option value="04">April</option>
        <option value="05">May</option>
        <option value="06">June</option>
        <option value="07">July</option>
        <option value="08">August</option>
        <option value="09">September</option>
        <option value="10">October</option>
        <option value="11">November</option>
        <option value="12">December</option>
    </select>
    
    <select name="day">
        <option> - Day - </option>
        <option value="01">1</option>
        <option value="02">2</option>
        <option value="03">3</option>
        <option value="04">4</option>
        <option value="05">5</option>
        <option value="06">6</option>
        <option value="07">7</option>
        <option value="08">8</option>
        <option value="09">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>
        <option value="30">30</option>
        <option value="31">31</option>
    </select>
    <select name="year">
    <?php
        $optionyear = date("Y",time());
        $currentyear = $optionyear;
        while($optionyear != 1990) {
            echo "<option value=\"".$optionyear."\"";
            if($optionyear == $currentyear) {
                echo " selected";
            }
            echo ">".$optionyear."</option>";
            $optionyear--;
        }
    ?>
    </select><br />
    <input type="submit" name="Submit" value="Upload" /><br />
    </form>

    However, no data passes to the next page (/wp-admin/admin.php?page=myplugin&upload=2)

    It seems that if I remove enctype=”multipart/form-data”, the form data passes, but then I don’t have a file upload. How it stands now, the file uploads, but I don’t get any $_POST or $_FILES data. Any ideas on what I could be doing wrong? Is it a server issue?

  • The topic ‘Custom Plugin – form not POSTing data’ is closed to new replies.