So I am working on a small project for my fathers business. I am done with the most part, but I still have to do some back-end development. I want the user to select some checkboxes and then see the fixed price from the selected (I am done with this), then the user types in their value and it multiplies by the fixed price given from the checkboxes. Here is the code:
<?php
//first part
if(isset( $_GET["choice"] )){
$food = $_GET["choice"];
$c = count($food);
$price = 0.0;
for($i=0;$i<$c;$i++){
if($food[$i] == 1){
$price = $price + 10;
echo "Вие избрахте:<br>";
echo "Лепене на гипсокартон<br>";
}
if($food[$i] == 2){
$price = $price + 12;
echo "Предстенна обшивка 1 пласт<br>";
}
if($food[$i] == 3){
$price = $price + 16;
echo "Предстенна обшивка 2 пласта<br>";
}
if($food[$i] == 4){
$price = $price + 18;
echo "Преградна стена с вата<br>";
}
if($food[$i] == 5){
$price = $price + 2;
echo "Редене на минерална и каменна вата<br>";
}
}
echo "<br>Общо за 1 кв/м: " .$price. "лв.<br>";
}
else{
echo 'Моля изберете нещо!';
}
//second part
echo "Въведете вашата квадратура <input type='text'name='finalprice'method='get'>";
echo "<input type='submit' valu='Изчисли'>"
$finalprice = $_GET["finalprice"];
if($finalprice[$i]>= 1){
$finalprice = $finalprice * $price;
echo "За вашата квадратура: " .$finalprice;
}
Aucun commentaire:
Enregistrer un commentaire