jeddi
08-09-2006, 03:18 PM
I have written some code to collect the date from three input fields and store it as a timestamp date format.
This is the code ;
echo "<div style='width:40px;position:absolute;left:400px; top:300px;' >
\n<select name=\"x_day\">\n";
for($day = 1; $day <= 31; $day++) {
if($day == $N_day) {
echo "<option value=\"$day\" selected= \"selected\" >$day</option>";
}
else {
echo "<option value=\"$day\">$day</option>";
}
}
echo "</select>\n</div>\n";
echo "<div style='width:40px;position:absolute;left:450px; top:300px;' >
\n<select name=\"x_month\">\n";
for($month = 1; $month <= 12; $month++) {
if($month == $N_month) {
echo "<option value=\"$month\" selected= \"selected\" >$month</option>";
}
else {
echo "<option value=\"$month\">$month</option>";
}
}
echo "</select>\n</div>\n";
echo "<div style='width:40px;position:absolute;left:500px; top:300px;' >
\n<select name=\"x_year\">\n";
for($year = 2006; $year <= 2007; $year++) {
if($year == $N_year) {
echo "<option value=\"$year\" selected= \"selected\" >$year</option>";
}
else {
echo "<option value=\"$year\">$year</option>";
}
}
echo "</select>\n</div>\n";
Just one problem - for editing the record I need to reverse the process!
A timestamp field from the database which looks like this:
1158440400
needs to be changed into the correct three variables namely:
$N_day, $N_month and $N_year which should be
something like 17,08,2006
Any ideas on how I do this ??
Thank you for help.
This is the code ;
echo "<div style='width:40px;position:absolute;left:400px; top:300px;' >
\n<select name=\"x_day\">\n";
for($day = 1; $day <= 31; $day++) {
if($day == $N_day) {
echo "<option value=\"$day\" selected= \"selected\" >$day</option>";
}
else {
echo "<option value=\"$day\">$day</option>";
}
}
echo "</select>\n</div>\n";
echo "<div style='width:40px;position:absolute;left:450px; top:300px;' >
\n<select name=\"x_month\">\n";
for($month = 1; $month <= 12; $month++) {
if($month == $N_month) {
echo "<option value=\"$month\" selected= \"selected\" >$month</option>";
}
else {
echo "<option value=\"$month\">$month</option>";
}
}
echo "</select>\n</div>\n";
echo "<div style='width:40px;position:absolute;left:500px; top:300px;' >
\n<select name=\"x_year\">\n";
for($year = 2006; $year <= 2007; $year++) {
if($year == $N_year) {
echo "<option value=\"$year\" selected= \"selected\" >$year</option>";
}
else {
echo "<option value=\"$year\">$year</option>";
}
}
echo "</select>\n</div>\n";
Just one problem - for editing the record I need to reverse the process!
A timestamp field from the database which looks like this:
1158440400
needs to be changed into the correct three variables namely:
$N_day, $N_month and $N_year which should be
something like 17,08,2006
Any ideas on how I do this ??
Thank you for help.