chris - 2009-11-28 01:42:47
this code below is causing me problems which l still have not been able to solve the problem.
THis is a form that user will edit his input after the other form is submitted.
The problem is, even if the user did not enter any dates, anytime the edit form is open, there is a wrong date which stats from 1999.11.30
This is causing me headdache and have not got a clue to allow the date either to have the present date or not to show. If this 1999 appears, saving after editing is not possible unless this date is earesd. Trying to make this formular user friendly, any help will help me...
Please any help will be much appreciated.
Thank you.-------------->
$result = my_sql_query("SELECT date_on, date_off FROM navi WHERE nid=$sel AND is_campaign IS NOT NULL","");
if(!isset($result[0])) {
$dateon = $result[1][0]['date_on'];
$dateoff = $result[1][0]['date_off'];
if($lang == "ger") {
if(!empty($dateon)) {
$on = explode("-", $dateon);
if(count($on) == 3)
$dateon = date("d.m.Y", mktime(0, 0, 0, $on[1], $on[2], $on[0]));
}
if(!empty($dateoff)) {
$off = explode("-", $dateoff);
if(count($off) == 3)
$dateoff = date("d.m.Y", mktime(0, 0, 0, $off[1], $off[2], $off[0]));
}
} else {
if(!empty($dateon)) {
$on = explode("-", $dateon);
if(count($on) == 3)
$dateon = date("Y-m-d", mktime(0, 0, 0, $on[1], $on[2], $on[0]));
}
if(!empty($dateoff)) {
$off = explode("-", $dateoff);
if(count($off) == 3)
$dateoff = date("Y-m-d", mktime(0, 0, 0, $off[1], $off[2], $off[0]));
}
}
} else {
echo $result[0];
}
echo "<tr align ='center'>\n"
."<td width='10%'></td>\n"
."<td width='70%'>"._FROM." <input name='startdate' type='text' value='$dateon' size='15' maxlength='10'> "._TO." <input name='enddate' type='text' value='$dateoff' size='15' maxlength='10'</td>\n"
."<td width='5%'></td>\n"
."</tr>\n"
."<tr align ='center'>\n"
."<td width='10%'></td>\n"
."<td width='70%' ><br /><input type='submit' name='save' value='"._SAVE."' id='button'> <input type='submit' name='reset3' value='"._RESET."' id='button'></td>\n"
."<td width='5%'></td>\n"
."</tr>\n";
echo "</table><br /></td></tr></table><br /><br />\n"
."</div>\n"
."</form>\n";
echo "<script>document.form1.title.focus();</script>\n";