Web Architecture Activating Websites Artful Totals and Discounts
29 August 04:07
Once your basal acknowledgment and email are all happening, and youre activity a bit added assured with your first PHP pages, its a acceptable time to alpha acquirements a bit added about PHP variabls and ascendancy structures! But afore affective on from here, amuse create abiding that your response.php currently:
If a company to your website indicates that they wish to buy 5 T-shirts at $15 each, we charge to let them understand what their absolute comes to! To do this, able-bodied charge to make a variable.
You ability accept noticed that variables in PHP consistently accept a dollar assurance ($) in foreground of them. Actuality are a few examples:
Can you assumption why the apostraphe () in $string2 has a back-slash () in foreground of it?
We charge to make a new capricious alleged $total in our response.php. Initially able-bodied set it to 0 like this:
but your claiming is to book out the absolute for the adjustment if your anatomy is submitted!
Now that weve affected the absolute for our order, we charge to cover a postage fee! The afterward exercise will advice you forth the way!
Lets say you adjudge it would be acceptable for business if you action chargeless supply if barter buy added than 6 items.
Your pseudo-code should attending something like this:
You ability wish to yield a attending at [http://au3.php.net/manual/en/language.control-structures.php#control-structures.if if-statements in the PHP manual] or [http://www.free2code.net/plugins/articles/read.php?id=259&page=6 Free2Codes account of if-statements] to get an abstraction of how if-statements plan in PHP (theyre about identical to if-statements in JavaScript).
TODO: Exercise with solution
Finally, if your barter absorb over $200 (modify to clothing your needs), they get a 10% discount.
TODO: Exercise with solution
Once your basal acknowledgment and email are all happening, and youre activity a bit added assured with your first PHP pages, its a acceptable time to alpha acquirements a bit added about PHP variabls and ascendancy structures! But afore affective on from here, amuse create abiding that your response.php currently:
If a company to your website indicates that they wish to buy 5 T-shirts at $15 each, we charge to let them understand what their absolute comes to! To do this, able-bodied charge to make a variable.
You ability accept noticed that variables in PHP consistently accept a dollar assurance ($) in foreground of them. Actuality are a few examples:
$num1 = 12; // This is a number
$string1 = Heres a cord in bifold quotes;
$string2 = Heres a cord in individual quotes;
Can you assumption why the apostraphe () in $string2 has a back-slash () in foreground of it?
We charge to make a new capricious alleged $total in our response.php. Initially able-bodied set it to 0 like this:
$total = 0; // Able-bodied use this capricious to account the absolute for the order
but your claiming is to book out the absolute for the adjustment if your anatomy is submitted!
Now that weve affected the absolute for our order, we charge to cover a postage fee! The afterward exercise will advice you forth the way!
Lets say you adjudge it would be acceptable for business if you action chargeless supply if barter buy added than 6 items.
Your pseudo-code should attending something like this:
if the abundance is beneath than 7 then do the following:
add the $20 postage fee to the total
You ability wish to yield a attending at [http://au3.php.net/manual/en/language.control-structures.php#control-structures.if if-statements in the PHP manual] or [http://www.free2code.net/plugins/articles/read.php?id=259&page=6 Free2Codes account of if-statements] to get an abstraction of how if-statements plan in PHP (theyre about identical to if-statements in JavaScript).
TODO: Exercise with solution
Finally, if your barter absorb over $200 (modify to clothing your needs), they get a 10% discount.
TODO: Exercise with solution
|
Tags: exercise, websites, design, statements, control, structures, response total, statements, exercise, variable, response, structures, control, , total for, control structures, todo exercise with, websites calculating totals, dynamic websites calculating, design dynamic websites, web design dynamic, |
Also see ...
PermalinkArticle In : Computers & Technology - Websites Help