|
Posted by Big Moxy on 08/04/07 03:00
On Aug 3, 8:22 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> Big Moxy wrote:
> > Would someone be so kind as to tell me what is wrong with this code?
>
> > (1) This code block indicates the session variable nomex is null.
> > if (is_null($_SESSION['nomex'])){
> > echo " is null.";
> > }
> > else {
> > echo " is not null.";
> > }
>
> > (2) However on the same page this code block always adds 100 to the
> > price.
> > if ($_SESSION['nomex'] != "^^no^^"){
>
> If it wasn't defined before, it is now.
>
> > if (!is_null($_SESSION['nomex'])){
>
> So this will never be true.
>
> > // NOMEX Lining
> > $new_price = $new_price + 100;
> > }
> > }
> > echo "$".$new_price;
>
> > Thank you very much!!
>
> BTW - if you're checking to see if something is set, isset() is better.
> But either way, check BEFORE you reference it.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
I think I understand your response however I am a PHP newbie so could
you please redo my code with isset()?
Thank you!
Navigation:
[Reply to this message]
|