I have a form for a user to enter event information. The form requests 3 separate dates (event start date, event end date and broadcast date). I call a function to display separate drop down lists for month/day/year on the form.
function displayDateDropdown($Title,$Month,$Day,$Year)
{
//Create an array of months
$monthName = array (1=> "January", "February", "March", etc.
/* Build selection list for the month */
echo "<select name='".$Title."_dateMO'>\n";
$SelectMonth[$Month]=" selected";
for ($n=1; $n<=12; $n++) {
echo "<option value=$n".$SelectMonth[$n].">$monthName[$n]</option>\n";
}
echo "</SELECT>\n";
etc..
I use the form in multiple instances (create, edit, copy an event), and in many cases, the start and end dates are the same day, while the broadcast date is always in the future.
$today = Time();
$start_dateMO = date("n", $today);
$start_dateDAY = date("j", $today);
$start_dateYR = date("Y", $today);
$end_dateMO = date("n", $today);
$end_dateDAY = date("j", $today);
$end_dateYR = date("Y", $today);
$broadcast_dateMO = 2;
$broadcast_dateDAY = 10;
$broadcast_dateYR = 2003;
I would like to call the function with the same variables in all 3 places on the form, (i.e., displayDateDropdown ($$Title,$$Month,$$Day,$$Year), instead of displayDateDropdown ("start_",$start_dateMO ,$start_dateDAY,$start_dateYR), etc.), but I can't quite get my hands around the dynamic variables.
Any help would be appreciated, Ruth