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
pleigh
Forum Contributor
Posts: 445 Joined: Wed Jan 19, 2005 4:26 am
Post
by pleigh » Tue Sep 06, 2005 1:36 am
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Sep 06, 2005 2:02 am
what's the error?
pleigh
Forum Contributor
Posts: 445 Joined: Wed Jan 19, 2005 4:26 am
Post
by pleigh » Tue Sep 06, 2005 2:30 am
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Sep 06, 2005 2:35 am
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?
pleigh
Forum Contributor
Posts: 445 Joined: Wed Jan 19, 2005 4:26 am
Post
by pleigh » Tue Sep 06, 2005 2:37 am
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...
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Sep 06, 2005 2:45 am
were any of them zero, perhaps?
pleigh
Forum Contributor
Posts: 445 Joined: Wed Jan 19, 2005 4:26 am
Post
by pleigh » Tue Sep 06, 2005 2:52 am
nope...i tried to input
textbox1=12 textbox2=12 textbox3=2001
or to be clear
12 12 2001
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Sep 06, 2005 2:59 am
okay.. I need to see a live page of this..
pleigh
Forum Contributor
Posts: 445 Joined: Wed Jan 19, 2005 4:26 am
Post
by pleigh » Tue Sep 06, 2005 3:01 am
ah that hurts...
...don't know how to show it to you but i'm willing to...i just don't know how...
pleigh
Forum Contributor
Posts: 445 Joined: Wed Jan 19, 2005 4:26 am
Post
by pleigh » Tue Sep 06, 2005 3:11 am
this is the result of my laziness...it always happen to me....i see now the problem...the above code is
and in the textbox name corresponding to that is "startdate"...how stupid am i...always...hehehe..
Code: Select all
<input name="startday" type="text" size="3"> -
but feyd, thanks a lot for assistance...