0

日付選択の値に基づいてレポートを実行するボタンがあります。このボタンの横に同様のボタンを作成して同じレポートを実行したいのですが、今日のみ、既存のコードに基づいてそのボタンの日付値を定義するにはどうすればよいですか?

     <tr bgcolor="#efefef" onMouseOver="this.bgColor='#ddddff';" onMouseOut="this.bgColor='#efefef';">
<td width="19%">Start Date</td>
<td width="81%"><select name="sd" style="width:100px;">
        <? 
        $current_day = date('d');
        $current_month = date('m');
        $current_year = date('Y');
        $cur = 1;
         while (31 >= $cur) {
         echo "<option value=\"".sprintf("%02d", $cur)."\" ".(($cur == $current_day)?'selected':'').">".sprintf("%02d", $cur)."</option>\n";
         $cur++;
         } ?>
      </select> &nbsp; <select name="sm" style="width:150px;">
        <? $cur = 1;
         while (12 >= $cur) {
         echo "<option value=\"".sprintf("%02d", $cur)."\" ".(($cur ==    ($current_month-1))?'selected':'').">".date("F", strtotime("2006-".sprintf("%02d",    $cur)."-01"))."</option>\n";
         $cur++;
         } ?>
      </select>  
      &nbsp; <select name="sy" style="width:100px;">
        <? $cur = 1;
        $curyear = date("Y");
         while (10 >= $cur) {
         echo "<option value=\"$curyear\">$curyear</option>\n";
         $curyear--;
         $cur++;
         } ?>
      </select> </td>
  </tr>
     <tr bgcolor="#efefef" onMouseOver="this.bgColor='#ddddff';" onMouseOut="this.bgColor='#efefef';">
<td>End Date</td>
<td><select name="ed" style="width:100px;">
        <? $cur = 1;
         while (31 >= $cur) {
         echo "<option value=\"".sprintf("%02d", $cur)."\" ".(($cur == $current_day)?'selected':'').">".sprintf("%02d", $cur)."</option>\n";
         $cur++;
         } ?>
      </select> &nbsp; <select name="em" style="width:150px;">
        <? $cur = 1;
         while (12 >= $cur) {
         echo "<option value=\"".sprintf("%02d", $cur)."\" ".(($cur == ($current_month))?'selected':'').">".date("F", strtotime("2006-".sprintf("%02d", $cur)."-01"))."</option>\n";
         $cur++;
         } ?>
      </select>  
      &nbsp; <select name="ey" style="width:100px;">
        <? $cur = 1;
        $curyear = date("Y");
         while (10 >= $cur) {
         echo "<option value=\"$curyear\">$curyear</option>\n";
         $curyear--;
         $cur++;
         } ?>
      </select> </td>
  </tr>
     <tr bgcolor="#efefef" onMouseOver="this.bgColor='#ddddff';" onMouseOut="this.bgColor='#efefef';">
       <td>&nbsp;</td>
       <td><input type="submit" name="button" id="button" value="Get Report"></td>
     </tr>
<tr>
  </table></form>

ここで Select 値が必要ないことは理解していますが、それで十分でしょうか?

PHP初心者!

4

1 に答える 1

2
<?php
if(isset($_REQUEST['submit']))
{
// put your code on selected date here..
}
else if(isset($_REQUEST['submit'])) // another submit button name
{
$current_day = date('d');
$current_month = date('m');
$current_year = date('Y');
}
?>
于 2013-07-11T12:24:44.720 に答える