Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello I want to calculate the checkbox and radio ass the total of additional fee I already
calculate the total price now i just want the total of the the additional option only .
i want the sum of keitai and komono with hout the flower price.

What I have tried:

	<title>Flower shop Takanawa


	<div style="text-align: center">
		<br>
		<h2>Welcome!<br>
			Flower shop # Takanawa # Welcome<br></h2>
			It's a small shop, but I look forward to your continued support.<br>
			<br>
		</div>
		
		<hr>
		(Name)<br>
		(Type)
		  Rose(2,800yen)  
		  Tulips(2,500yen) 
	      Gerbera(1,800yen) 
	      Carnation(1,200yen)  
	      Casablanca(5,800yen)
	  <br>
	  (Form)Bouquet(no additional charge)
	       Potted plant(additional charge 800yen)
	       Preserved flower(additional charge 3000 yen)<br>
	       (accessories)Message card (additional 150 yen)   
	       Flower language dictionary (additional 500yen)
	       Gardening set (additional 1,500yen)
	       <br>
	       <hr>
	        
		
		<br>
	


	
	

the code 


	   
 


\n";
   print "<br>\n";

    $structName= array("Bouquet","potted plant", "preserved flower");

    $structPrice = array(0,800,3000);

    $keitai = $_POST["keitai"];
    $sum= $flowerPrice[$hana]+ $structPrice[$keitai];
    print "(Form)$structName[$keitai]:$structPrice[$keitai] yen<br>\n";
  
    $accessoryName = array("Message card","Flower language dictionary","Gardening set");
    $accessoryPrice = array(150,500,1500);
  
     
for($i =0; $i <3; $i++){
    	if($_POST["komono".(string)$i]=="on"){
    		print"(accessory)$accessoryName[$i]:$accessoryPrice[$i] yen<br>\n";
    		$sum= $sum + $accessoryPrice[$i];
               
    	}
            
    }
     
    print "<br>\n";
    print "<hr><span style="color: blue">(total price)$sum yen <br>\n";
    
?>

</span>
Posted
Comments
Andre Oosthuizen 24-Jun-20 6:46am    
Your sum will not work as you made komono a string and your keitai is an integer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900