Jump to content

cspgsl

Members
  • Posts

    26
  • Joined

  • Last visited

Everything posted by cspgsl

  1. Even though it is great to learn it sucks to be new... I really do appreciate the help however !! My order entry form is at www.php.cedarsprings.cc It seems to work with one exception, when I order a plan and a toolkit the total order is supposed to include the plan price + the toolkit price + the toolkit setup charge... all + tax. Thus far the php code returns the correct items sold and calculates the order total for the plans and the toolkits but will not add the appropriate setup charge to the order. $totalamount includes all of the variables so I just acnnot see what i'm missing. Again, thanks in advance [code] <?php // create short variable names $pro = $_POST['pro']; $comp = $_POST['comp']; $personal = $_POST['personal']; $diy = $_POST['diy']; $host = $_POST['host']; $qna = $_POST['qna']; $facts = $_POST['facts']; $calc = $_POST['calc']; $news = $_POST['news']; $setupcomp = $_POST['setupcomp']; $setuppersonal = $_POST['setuppersonal']; $setuphost = $_POST['setuphost']; echo '<p>Your order is as follows: </p>'; $totalqty = 0; $totalqty = $pro + $comp + $personal + $diy + $host + $qna + $facts + $calc + $news + $setupcomp + $setuppersonal + $setupdiy + $setuphost; echo 'Items Ordered: '.$totalqty.'<br />'; $totalamount = 0.00; define('PROPRICE', 1.00); define('COMPPRICE', 1.00); define('PERSONALPRICE', 1.00); define('DIYPRICE', 1.00); define('HOSTPRICE', 1.00); define('QNAPRICE', 1.00); define('FACTSPRICE', 1.00); define('CALCPRICE', 1.00); define('NEWSPRICE', 1.00); define('SETUPCOMPPRICE', 1.00); define('SETUPPERSONALPRICE', 1.00); define('SETUPDIYPRICE', 1.00); define('SETUPHOSTPRICE', 1.00); $totalamount =     $pro * PROPRICE                 + $comp * COMPPRICE                 + $personal * PERSONALPRICE                 + $diy * DIYPRICE                 + $host * HOSTPRICE                                                                                 + $qna * QNAPRICE                 + $facts * FACTSPRICE                                                 + $calc * CALCPRICE                                                 + $news * NEWSPRICE;                                                 + $setupcomp * SETUPCOMPPRICE;                                                 + $setuppersonal * SETUPPERSONALPRICE;                                                 + $setupdiy * SETUPDIYPRICE;                                                 + $setuphost * SETUPHOSTPRICE;                                                 if( $comp &&  ($qna>0||$facts>0||$calc>0||$news>0))                     $setupcomp = 1;                 elseif( $personal &&  ($qna>0||$facts>0||$calc>0||$news>0))                     $setuppersonal = 1;                 elseif( $diy &&  ($qna>0||$facts>0||$calc>0||$news>0))                     $setupdiy = 1;                 elseif( $host &&  ($qna>0||$facts>0||$calc>0||$news>0))                     $setuphost = 1; echo 'Subtotal: $'.number_format($totalamount,2).'<br />'; $taxrate = 0.15; // local salestax is 15% $totalamount = ($totalamount) * (1 + $taxrate); echo 'Total including tax: $'.number_format ($totalamount,2).'<br />';                                 if( $totalqty == 0 )                 {                 echo '<font color=red>';                 echo 'You did not order anything! <br />';                 echo '</font>';                 }                                  if( $pro + $comp + $personal + $diy + $host> 1 )                 {                 echo '<font color=red>';                 echo 'You may only order one hosting plan! <br /> Please press your browsers back button and select the plan you want <br /> Your order cannot be processed<br />';                 echo '</font>';                 }                 if( $pro + $comp + $personal + $diy + $host == 0 )                 {                 echo '<font color=red>';                 echo 'You must order one hosting plan! <br /> Please press your browsers back button and make a selection <br />Your order cannot be processed<br />';                 echo '</font>';                 }                 else                 {                 if ($pro> 0 )                     echo $pro.' Professional Plan<br />';                 if ($comp> 0 )                     echo $comp.' Comprehensive Plan<br />';                 if ($personal> 0 )                     echo $personal.' Personal Plan<br />';                 if ($diy> 0 )                     echo $diy.' DIY Plan<br />';                 if ($host> 0 )                     echo $host.' Hosting Only Plan<br />';                 if ($qna> 0 )                     echo $qna.' Quick Q &amp; A ToolKit<br />';                 if ($facts> 0 )                     echo $facts.' Quick Facts ToolKit<br />';                 if ($calc> 0 )                     echo $calc.' Calculators ToolKit<br />';                 if ($news> 0 )                     echo $news.' Quarterly Newsletters ToolKit<br />';                 if($pro>0 && ($qna>0||$facts>0||$calc>0||$news>0))                     echo $setupcomp.' Professional Plan ToolKit Setup No Charge<br />';                 if ($comp>0 && ($qna>0||$facts>0||$calc>0||$news>0))                     echo $setupcomp.' Comprehensive Plan ToolKit Setup Charge<br />';                 if ($personal>0 && ($qna>0||$facts>0||$calc>0||$news>0))                     echo $setuppersonal.' Personal Plan ToolKit Setup Charge<br />';                 if ($diy>0 && ($qna>0||$facts>0||$calc>0||$news>0))                     echo $setupdiy.' DIY Plan ToolKit Setup Charge<br />';                 if ($host>0 && ($qna>0||$facts>0||$calc>0||$news>0))                     echo $setuphost.' Hosting Only Plan ToolKit Setup Charge<br />';                 }                  echo '<p>Order processed at '; echo date('H:i, jS F'); echo '</p>'; ?> [/code] Edited by toplay: To enclose code in forum code tags.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.