(This has been posted on the PHP.general group also.)
I'm writing an app where I want the user to be able to change a date on
a record. Date field is 'TngDate'. I can pull the record from the
mySql database, split it into day/month/year, put each in a drop down
box. What I can't seem to do is collect the modified entries,
reassemble them into a single variable and pass it on to the update
script. I admit to being a newbie at this and most of my scripts
(including this one) come from examples that I have found either on the
'Net or in books. The script below is the script I have so far.
It's in an include file. I would appreciate any help.
<?php
$monthName = array(1=> "January", "February", "March", "April", "May",
"June", "July", "August", "September", "October", "November",
"December"); $f_today = $formValues["TngDate"]; echo $f_today;
/* create form containing date selection list */
echo "<form method='post'>\n";
/* build selection list for the month */
$todayMO = substr($f_today,5,2);
echo "<select name='dateMO'>\n";
for ($n=1;$n<=12;$n++)
{
echo "<option value=$n\n";
if ($todayMO == $n)
{
echo " selected";
}
echo "> $monthName[$n]\n";
}
echo "</select>";
/* build selection list for the day */
$todayDay = substr($f_today, 8,2);
echo "<select name='dateDay'>\n";
for ($n=1;$n<=31;$n++)
{
echo "<option value=$n\n";
if ($todayDay == $n)
{
echo " selected";
}
echo "> $n\n";
}
echo "</select>\n";
/* build selection list for the year */
$startYr = substr($f_today, 0,4);
echo "<select name='dateYr'>\n";
for ($n=$startYr;$n<=$startYr+3;$n++)
{
echo "<option value=$n\n";
if ($startYr == $n)
{
echo " selected";
}
echo "> $n\n";
}
$newDate=date("Y-m-d", mktime(0,0,0, $todayMO, $todayDay, $startYr));
echo "</select>"; $newTngDate = strtotime("$newDate"); echo
"</form>\n"; ?>