we have button runs reports based on date selects' values. want create similar button next 1 run same report today only, how define date values button based on existing code?
<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> <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> <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> <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> <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> </td> <td><input type="submit" name="button" id="button" value="get report"></td> </tr> <tr> </table></form>
i understand don't need select values here, i'd need do?
php noob!
<?php if(isset($_request['submit'])) { // put code on selected date here.. } else if(isset($_request['submit'])) // submit button name { $current_day = date('d'); $current_month = date('m'); $current_year = date('y'); } ?>
Comments
Post a Comment