Re: Newbie Problem using if statement with &&
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sun, 01 Jun 2008 22:10:07 -0400
John wrote:
On Jun 1, 4:42 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:> Yeah I have tested the vslues and they are valid. As i said in theJohn wrote:Hello all.When things like this fail, a good first step is to echo the values
I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:
if ($_REQUEST["frmIsEarlyBird"] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird"]) {
die("<h1>The earlybird special has ended.</h1>");
}
Ok when the code runs it and both conditions are true nothing happens.
Testing:
$_REQUEST["frmIsEarlyBird"] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
$rowWork["wEarlyBird"] Has a valid date in it and should validate as
true
If i put these if statements on the page they both work fine.
if ($_REQUEST["frmIsEarlyBird"] == "1") {
echo "<br><br>TRUE<br><br>";
} else {
echo "<br><br>False<br><br>";
}
if (date("Y-m-d") < $rowWork["wEarlyBird"]) {
echo "<br><br>TRUE<br><br>";
} else {
echo "<br><br>False<br><br>";
}
Thanks in advance for any help
involved.
For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird"]
and $rowWork["wEarlyBird"]? Are you getting what you think you should
be getting from date("Y-m-d")? Also - is $_REQUEST["frmIsEarlyBird"]
equal to "1" or 1? They are two different values.
Also, $_REQUEST is generally not a good thing to use, If it's coming
from a POSTed forum, use $_POST. If it's in the URL, use $_GET.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================- Hide quoted text -
- Show quoted text -
> original post:
>
>
> Testing:
>
> $_REQUEST["frmIsEarlyBird"] is a valid form request and returns a
> string of 1 or 0 depending on what im sending.
>
> $rowWork["wEarlyBird"] Has a valid date in it and should validate as
> true
>
> If i put these if statements on the page they both work fine.
> (validate as true)
>
> if ($_REQUEST["frmIsEarlyBird"] == "1") {
> echo "<br><br>TRUE<br><br>";
> } else {
> echo "<br><br>False<br><br>";
> }
>
> if (date("Y-m-d") < $rowWork["wEarlyBird"]) {
> echo "<br><br>TRUE<br><br>";
> } else {
> echo "<br><br>False<br><br>";
> }
>
(Top posting fixed)
Well, obviously something is not as you describe, because '&&' has a lower priority than either '==' or '<', which is why I asked you to verify this. It's either the data or the statement you supplied doesn't match what you have in your code. I'm just trying to eliminate possibilities.
P.S. Please don't top post. Thanks.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- References:
- Newbie Problem using if statement with &&
- From: John
- Re: Newbie Problem using if statement with &&
- From: Jerry Stuckle
- Re: Newbie Problem using if statement with &&
- From: John
- Newbie Problem using if statement with &&
- Prev by Date: Re: Newbie Problem using if statement with &&
- Next by Date: Re: Read a 'lot' of file
- Previous by thread: Re: Newbie Problem using if statement with &&
- Next by thread: Re: Newbie Problem using if statement with &&
- Index(es):
Relevant Pages
|