PHP! Need help with a calculator.?

  • Thread starter Thread starter Ashley!
  • Start date Start date
A

Ashley!

Guest
Hi, i am making a calculator for a website.

I have two equations set up (below): one is for if you are located in MO, so sales tax would apply. the other is for any other state (no sales tax would apply.)

Here are the equations the way i have them set up:

if ($state = ('MO')){
$price = ((($package + ($songs * $songprice) + ($ts * $tsprice) + ($copies * $copyprice)) * $tax) + $ship);
}
else {
$price = (($package + ($songs * $songprice) + ($ts * $tsprice) + ($copies * $copyprice) + $ship));
}


all variables are irrelevant, the line i think i am having trouble with is the line with " if ($state = ('MO')){ "

Thanks for your help
 
Right now you are setting the variable $state to the string MO instead of trying to compare them.

You Have: if ($state = ('MO')){

You Need: if ($state == ('MO')){
 
Right now you are setting the variable $state to the string MO instead of trying to compare them.

You Have: if ($state = ('MO')){

You Need: if ($state == ('MO')){
 
Back
Top