PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Ir0nSpIkE
Forum Newbie
Posts: 7 Joined: Mon May 16, 2005 4:25 pm
Location: On the Island, BC Canada
Post
by Ir0nSpIkE » Mon May 16, 2005 6:22 pm
I've created a functions that creates a Month dropdown that is pre-populated with the current month + x. Something like:
Code: Select all
function MonthDropDown($size=90,$default="DropDate")
{ $skip=1;
echo "<select name=$default STYLE=\"font-family: monospace;\">\n";
for ($i = 0; $i <= $size; $i++)
{ $theMonth = mktime (0,0,0,date("m") ,date("d")+$i ,date("Y"));
$option=date("D M j, Y",$theday);
...
}
echo "</select>\n";
return date("m/d/Y",$theMonth);
}
At the moment I have 3 functions for month day & year. I concatinate the results into the date format I want. My problem is how to use this date as input to a submit button to another page. Or am I going up a tree using this approach?
Jcart | Please use Code: Select all
tags when posting php code. [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
SBro
Forum Commoner
Posts: 98 Joined: Tue Sep 30, 2003 10:06 pm
Post
by SBro » Mon May 16, 2005 7:19 pm
Put the date into a session and then retrieve it on the next page ie.
Code: Select all
session_start();
function MonthDropDown($size=90,$default="DropDate")
{ $skip=1;
echo "<select name=$default STYLE=\"font-family: monospace;\">\n";
for ($i = 0; $i <= $size; $i++)
{ $theMonth = mktime (0,0,0,date("m") ,date("d")+$i ,date("Y"));
$option=date("D M j, Y",$theday);
...
}
echo "</select>\n";
return date("m/d/Y",$theMonth);
}
$_SESSION['date'] = MonthDropDown();
Then on the next page where you want to put it into a input field:
Code: Select all
<?php session_start(); ?>
<input type="e;Submit"e; name="e;Date"e; value="e;<?=$_SESSIONї'date'];?>"e;>
Burrito
Spockulator
Posts: 4715 Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah
Post
by Burrito » Tue May 17, 2005 12:07 am
or you could use JS and do it all on one page...