/    Sign up×
Community /Pin to ProfileBookmark

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

[url]http://kodiaksnow.ca/contract3.php[/url]

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

you can try the script.

Thanks!!

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@vanquishlaauthorAug 28.2012 — 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
Copy linkTweet thisAlerts:
@criterion9Aug 28.2012 — Logic error
[code=php]
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";}
[/code]

Reads like:
<i>
</i>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.
×

Success!

Help @vanquishla spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...