简体   繁体   中英

html dropdown form post to php

I have a strange error with my form. I always get a Daily selection with a date of 01 Jan 2000. The code for the form is this:

<!DOCTYPE html>
<html>
  <body>
    <form name="mainForm" action="ReportForm.php" method="post">
      How Often to Generate Report: 
      <select id="period" onchange="Change(this);">
        <option selected="selected" value="0">Daily</option>
        <option value="1">Weekly</option>
        <option value="2">Monthly</option>
      </select>

      <br />

      <input type="submit" title="Submit"/>
    </form>
  </body>
</html>

There are 3 more dropdowns like this for month, day, and year. I might have guessed that the selected="selected" had something to do with it, but the year 2000 is not an option. The default values for theses are January, 1, and 2012. I am thoroughly confused by this, and would appreciate any help.

The PHP associated with this is:

<?php
  require "Search.php";
  require "Schedule.php";

  Schedule( $_POST['period'],
                  mktime(23, 59, 59, $_POST['month'],
                         $_POST['day'], $_POST['year']) );

  Search( "param1", "param2", "param3", "test@testing.com" );

  exit();
?>

Thanks,

-rusty

Form elements require a NAME attribute in order to be posted. You have an ID instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM