www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help! Trying to make my code discount

  1. #1
    Join Date
    Jun 2012
    Posts
    6

    Help! Trying to make my code discount

    A form builds a pdf which shows prices for driveway cleaning.

    If its a single driveway its 15.00 off if its shared is only 7.50 off

    For some reason it only shows 15.00 off also trying to get it to minus from the price under it..

    if ($payment == "Before") {
    {$pre="7.50";}
    if (($driveway == "Single Shared") || ($driveway == "1.5 Shared") || ($driveway == "Double Shared") || ($driveway == "2.5 Shared")) {$pre="7.50";}
    } else {$pre="15.00";}

    Also the php file is

    http://kodiaksnow.ca/contract3.php

    and if you goto http://kodiaksnow.ca/cheque.html

    you can try the script.

    Thanks!!

  2. #2
    Join Date
    Jun 2012
    Posts
    6
    Update so the code above is suppose to figure out if its shared if shared it will be 7.50 if not 15.00 for some reason it only shows 15.00

  3. #3
    Join Date
    Jan 2009
    Posts
    3,346
    Logic error
    PHP Code:
    if ($payment == "Before") {
    {
    $pre="7.50";}
    if ((
    $driveway == "Single Shared") || ($driveway == "1.5 Shared") || ($driveway == "Double Shared") || ($driveway == "2.5 Shared")) {$pre="7.50";}
    } else {
    $pre="15.00";} 
    Reads like:
    Code:
    if(condition){
       set "pre" to 7.5
    } 
    if(many conditions){
       set "pre" to 7.5
    } else {
       set "pre" to 15
    }
    I'm surprised the code ran at all with all the extra curly brackets.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles