John Davidson

php - populating a list of checkboxes from a database, some variables are unique

0 comments
Message:


I have a list of places to visit in the boat tours I organise, the tour locations of which can change occasionally, including the price for each. So I have found a way to populate the list of possible locations and accommodation and other possible costs, so that I can quickly compute the total costs for each custom tour, with a simple checkbox (the checkbox for the customer to decide which places to visit or stay at). The entrance fees and hotel etc costs for most places are per person, but some are per boat, such as the case of beer, or a van transfer of the group to their final destination. In such cases the charge for each location ($priceofspot) would not be multiplied by the number of people in the group ($ppl). I guess this should be inserted in some sort of While loop or something? I have no idea which direction to go to resolve this, even some basic pointers would be greatly appreciated, thank you.


if(in_array($place,$spotsarray)) {
print "<input name='spots[]' value='".$place."' type='checkbox' checked='checked' />&nbsp;".$place." - ".$priceofspot."<br>";
if (($place='Case of beer') OR ($place='Van Transfer Sibaltan'))
{$totalspotcost=$totalspotcost+$priceofspot;}
else {$totalspotcost=$totalspotcost+($priceofspot*$ppl);}
}
else print "<input name='spots[]' value='".$place."' type='checkbox' />&nbsp;".$place." - ".$priceofspot."<br>";


My Answer:
(' '.$place.' - $'.$priceofspot.'
');_}

Rate this post

3 of 5 based on 6885 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us