problematic about this date for hours...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

problematic about this date for hours...

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what's the error?
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

were any of them zero, perhaps?
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

nope...i tried to input
textbox1=12 textbox2=12 textbox3=2001
or to be clear
12 12 2001
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

okay.. I need to see a live page of this..
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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:
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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... :)
Post Reply