Page 1 of 1

problematic about this date for hours...

Posted: Tue Sep 06, 2005 1:36 am
by pleigh
i have a code here that generates an error whenever the the textboxes have values
the above is

Code: Select all

//check for project duration start date
if (empty($_POST['startmonth']) || empty($_POST['startday']) || empty($_POST['startyear']))
{
    $sd = false;
    $message .= 'You forgot to enter the project start date<br>';
}
else
{
    $sd = $_POST['startyear']."-".$_POST['startmonth']."-".$_POST['startday'];
}

//other codes goes here...
then the forms code is

Code: Select all

<input name="startmonth" type="text" size="3"> -
<input name="startdate" type="text" size="3"> -
<input name="startyear" type="text" size="6">
when i supply some data during runtime, the error message appears...any help will be much appreciated.:)

thanks in advance

Posted: Tue Sep 06, 2005 2:02 am
by feyd
what's the error?

Posted: Tue Sep 06, 2005 2:30 am
by pleigh
sorry, lack of details... :)

here's the error

Code: Select all

$message .= 'You forgot to enter the project start date<br>';
it prompts whenever i put data or not inside the textboxes

Posted: Tue Sep 06, 2005 2:35 am
by feyd
assuming your form does in fact post the fields, that chunk of code should only execute if any one of those fields is considered empty... what values you are inputing?

Posted: Tue Sep 06, 2005 2:37 am
by pleigh
i input just numbers inside the textboxes...i always complete my input to those textboxes, that is why i'm wondering why the error message prompts...

Posted: Tue Sep 06, 2005 2:45 am
by feyd
were any of them zero, perhaps?

Posted: Tue Sep 06, 2005 2:52 am
by pleigh
nope...i tried to input
textbox1=12 textbox2=12 textbox3=2001
or to be clear
12 12 2001

Posted: Tue Sep 06, 2005 2:59 am
by feyd
okay.. I need to see a live page of this..

Posted: Tue Sep 06, 2005 3:01 am
by pleigh
ah that hurts... 8O ...don't know how to show it to you but i'm willing to...i just don't know how... :oops:

Posted: Tue Sep 06, 2005 3:11 am
by pleigh
this is the result of my laziness...it always happen to me....i see now the problem...the above code is

Code: Select all

empty($_POST['startday'])
and in the textbox name corresponding to that is "startdate"...how stupid am i...always...hehehe.. :D :lol:

Code: Select all

<input name="startday" type="text" size="3"> -
but feyd, thanks a lot for assistance... :)