Hey guys
this is real easy but I can't find the code anywhere and cannot remember how to do it.
All I need is the php code to make a drop down (select) box for the days in a month
Thanks
andy
I am gettin fed up of date drop downs
Moderator: General Moderators
-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
<form name"blabla" method="" action"">
<select name="blabla">
<?
?>
</select>
</form>
<select name="blabla">
<?
Code: Select all
for($i;$<32;$i++)
{
echo "<option>$i</option>";
}</select>
</form>
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Do you want a drop down for a particular month? The current month? All the months in the current year? Or something else?
Here's the code for the current month, with the current day already selected:
The other solutions are left as an exercise for the original poster. 
Here's the code for the current month, with the current day already selected:
Code: Select all
<?php
$td = date('j',strtotime('today'));
echo '<form method=post>'."\n";
echo date('F: ',strtotime('today'));
echo '<select name=dayofmonth size=1><option value=" "> </option>'."\n";
for ($d=1;$d<date('t',strtotime('today'))+1;$d++) {
echo '<option value='.$d;
if ($d == $td) echo ' selected ';
echo '>'.$d.'</option>'."\n"; }
echo '</select>'."\n";
echo '<input type=submit name=submit value="Select Day"></form>';
echo '<hr>';
if (isset($_POST['submit'])) {
echo '<pre>';print_r($_POST);echo '</pre>'; }
?>-
andylyon87
- Forum Contributor
- Posts: 168
- Joined: Sat Jan 31, 2004 5:31 am
- Location: Dundee
I use this: http://www.softcomplex.com/products/tigra_calendar/ .. Its free, flexible, and works everywhere.
And it's Javascript...onion2k wrote:I use this: http://www.softcomplex.com/products/tigra_calendar/ .. Its free, flexible, and works everywhere.
Also, how do you know the original poster wanted a full blown calendar program?
Ken
They'll still see the input box for the date though, so the application will work fine. Client-side things are only an issue if they break functionality of a site when the client hasn't got scripting switched on.kenrbnsn wrote:And it's Javascript...So if someone who has Javascript turned off accesses you site, they can't see your calendar.
As for him not requiring a full-blown calendar.. fair enough. I said I use it. I didn't say he has to.