Re: Validating a Session value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First you need to alter you else if statements, you write :

    If $session_ValueA >$100 and < $499 set $session_fee=$20

I would write :

    if(($session_ValueA >=100) and ($session_ValueA <=499)){
        $session_fee=20;
    }

And as you see, you cant evaluate >$20 since PHP doesnt know
that $20 is 20 dollars. It assumes its a variable with name of 20.
The $ (dollarsign), in your case, is just for show. Same goes for the
fee. You will need to work with the numbers only, knowing their
currency, then when you print it out you can typically  :

echo '$' . $session_fee;

Have another go!

-- 
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------


"Aleks Kalynovych" <aleks.k@xxxxxxx> wrote in message
news:266HkwB3R8704S13.1069552457@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

I am trying to figure out a way to calculate a value based on another value
and then set that value in a session variable.

So, if $session_ValueA <= $100 set $session_fee = $10
Or
If $session_ValueA >$100 and < $499 set $session_fee=$20
Or
If $session_VAlueA >$499 and <$999 set $session_fee=$50

Or something like this., I have to evaluate $session_ValueA to 6 possible
values.

Once this is done, I also would like to be able to calculate a % of
Session_ValueA
As commission. I tried to use If, Else but can't seem to get it right..

Any suggestions?? Thanks

Aleks =

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux