an IF and ELSE function
cannot function if it has too many conditions or its just my codes are wrong??
cause the ELSE didnt show up.
if ( (isset($_POST['submit'])) && ( (isset($_POST['pica10'])) || (isset($_POST['pica14'])) || (isset($_POST['pica18'])) || (isset($_POST['pgata10'])) || (isset($_POST['pgata14'])) || (isset($_POST['pgata18']))
|| (isset($_POST['mmec10'])) || (isset($_POST['mmec14'])) || (isset($_POST['mmec18'])) || (isset($_POST['mpae10'])) || (isset($_POST['mpae14'])) || (isset($_POST['mpae18'])) || (isset($_POST['mpica10'])) || (isset($_POST['mpica14'])) || (isset($_POST['mpica18']))
|| (isset($_POST['mrel110'])) || (isset($_POST['mrel114'])) || (isset($_POST['mrel118'])) || (isset($_POST['coke'])) || (isset($_POST['cokezero'])) || (isset($_POST['spr'])) || (isset($_POST['minmaid'])) ))
{
## the following prevent undefined error beyond the php 5.2.X versions.
$s1_quant = "";
$m1_quant = "";
$l1_quant = "";
$s2_quant = "";
$m2_quant = "";
$l2_quant = "";
$s3_quant = "";
$m3_quant = "";
$l3_quant = "";
$s4_quant = "";
$m4_quant = "";
$l4_quant = "";
$s5_quant = "";
$m5_quant = "";
$l5_quant = "";
$s6_quant = "";
$m6_quant = "";
$l6_quant = "";
$ck_quant = "";
$ckz_quant = "";
$spr_quant = "";
$min_quant = "";
$s1_cost = "";
$m1_cost = "";
$l1_cost = "";
$s2_cost = "";
$m2_cost = "";
$l2_cost = "";
$s3_cost = "";
$m3_cost = "";
$l3_cost = "";
$s4_cost = "";
$m4_cost = "";
$l4_cost = "";
$s5_cost = "";
$m5_cost = "";
$l5_cost = "";
$s6_cost = "";
$m6_cost = "";
$l6_cost = "";
$ck_cost = "";
$ckz_cost = "";
$spr_cost = "";
$min_cost = "";
echo "<center><h2>Order Summary</h2></center>";
## process the form. What matters here the most is to know if the checkbox is ticked
## process small pizza if it is tick.
if(!empty($_POST['pica10'])){
$s1_quant = $_POST['sq1'];
echo "<b>Pizza CarneNorte: 10 inches pizza</b><br/>Quantity: ".$s1_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$s1_cost = 300 * ( $s1_quant);
echo "Price: ".$s1_cost."<br/>";
}
if(!empty($_POST['pica14'])){
$m1_quant = $_POST['mq1'];
echo "<b> Pizza CarneNorte: 14 inches pizza</b><br/>Quantity: ".$m1_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$m1_cost = 450 * ( $m1_quant);
echo "Price: ".$m1_cost."<br/>";
}
if(!empty($_POST['pica18'])){
$l1_quant = $_POST['lq1'];
echo "<b> Pizza CarneNorte: 18 inches pizza</b><br/>Quantity: ".$l1_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$l1_cost = 650 * ( $l1_quant);
echo "Price: ".$l1_cost."<br/>";
}
if(!empty($_POST['pgata10'])){
$s2_quant = $_POST['sq2'];
echo "<b> Pizza Gata: 10 inches pizza</b><br/>Quantity: ".$s2_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$s2_cost = 350 * ( $s2_quant);
echo "Price: ".$s2_cost."<br/>";
}
if(!empty($_POST['pgata14'])){
$m2_quant = $_POST['mq2'];
echo "<b> Pizza Gata: 14 inches pizza</b><br/>Quantity: ".$m2_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$m2_cost = 550 * ( $m2_quant);
echo "Price: ".$m2_cost."<br/>";
}
if(!empty($_POST['pgata18'])){
$l2_quant = $_POST['lq2'];
echo "<b> Pizza Gata: 18 inches pizza</b><br/>Quantity: ".$l2_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$l2_cost = 750 * ( $l2_quant);
echo "Price: ".$l2_cost."<br/>";
}
if(!empty($_POST['mmec10'])){
$s3_quant = $_POST['sq3'];
echo "<b> Pizza Mechado: 10 inches pizza</b><br/>Quantity: ".$s3_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$s3_cost = 380 * ( $s3_quant);
echo "Price: ".$s3_cost."<br/>";
}
if(!empty($_POST['mmec14'])){
$m3_quant = $_POST['mq3'];
echo "<b> Pizza Mechado: 14 inches pizza</b><br/>Quantity: ".$m3_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$m3_cost = 550 * ( $m3_quant);
echo "Price: ".$m3_cost."<br/>";
}
if(!empty($_POST['mmec18'])){
$l3_quant = $_POST['lq3'];
echo "<b> Pizza Mechado: 18 inches pizza</b><br/>Quantity: ".$l3_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$l3_cost = 790 * ( $l3_quant);
echo "Price: ".$l3_cost."<br/>";
}
if(!empty($_POST['mpae10'])){
$s4_quant = $_POST['sq4'];
echo "<b> Pizza Paella: 10 inches pizza</b><br/>Quantity: ".$s4_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$s4_cost = 350 * ( $s4_quant);
echo "Price: ".$s4_cost."<br/>";
}
if(!empty($_POST['mpae14'])){
$m4_quant = $_POST['mq4'];
echo "<b> Pizza Paella 14 inches pizza</b><br/>Quantity: ".$m4_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$m4_cost = 520 * ( $m4_quant);
echo "Price: ".$m4_cost."<br/>";
}
if(!empty($_POST['mpae18'])){
$l4_quant = $_POST['lq4'];
echo "<b> Pizza Paella: 18 inches pizza</b><br/>Quantity: ".$l4_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$l4_cost = 700 * ( $l4_quant);
echo "Price: ".$l4_cost."<br/>";
}
if(!empty($_POST['mpica10'])){
$s5_quant = $_POST['sq5'];
echo "<b> Pizza Picadillo: 10 inches pizza</b><br/>Quantity: ".$s5_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$s5_cost = 280 * ( $s5_quant);
echo "Price: ".$s5_cost."<br/>";
}
if(!empty($_POST['mpica14'])){
$m5_quant = $_POST['mq5'];
echo "<b> Pizza Picadillo: 14 inches pizza</b><br/>Quantity: ".$m5_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$m5_cost = 350 * ( $m5_quant);
echo "Price: ".$m5_cost."<br/>";
}
if(!empty($_POST['mpica18'])){
$l5_quant = $_POST['lq5'];
echo "<b> Pizza Picadillo: 18 inches pizza</b><br/>Quantity: ".$l5_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$l5_cost = 450 * ( $l5_quant);
echo "Price: ".$l5_cost."<br/>";
}
if(!empty($_POST['mrel110'])){
$s6_quant = $_POST['sq6'];
echo "<b> Pizza Relleno: 10 inches pizza</b><br/>Quantity: ".$s6_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$s6_cost = 300 * ( $s6_quant);
echo "Price: ".$s6_cost."<br/>";
}
if(!empty($_POST['mrel114'])){
$m6_quant = $_POST['mq6'];
echo "<b> Pizza Relleno: 14 inches pizza</b><br/>Quantity: ".$m6_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$m6_cost = 450 * ( $m6_quant);
echo "Price: ".$m6_cost."<br/>";
}
if(!empty($_POST['mrel118'])){
$l6_quant = $_POST['lq6'];
echo "<b> Pizza Relleno: 18 inches pizza</b><br/>Quantity: ".$l6_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$l6_cost = 650 * ( $l6_quant);
echo "Price: ".$l6_cost."<br/>";
}
if(!empty($_POST['coke'])){
$ck_quant = $_POST['cok'];
echo "<b> Coke: 1.5 Liters</b><br/>Quantity: ".$ck_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$ck_cost = 50 * ( $ck_quant);
echo "Price: ".$ck_cost."<br/>";
}
if(!empty($_POST['cokezero'])){
$ckz_quant = $_POST['cokzer'];
echo "<b> Coke Zero: 1.5 Liters</b><br/>Quantity: ".$ckz_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$ckz_cost = 55 * ( $ckz_quant);
echo "Price: ".$ckz_cost."<br/>";
}
if(!empty($_POST['spr'])){
$spr_quant = $_POST['spr'];
echo "<b> Sprite: 1.25 Liters</b><br/>Quantity: ".$spr_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$spr_cost = 50 * ( $spr_quant);
echo "Price: ".$spr_cost."<br/>";
}
if(!empty($_POST['minmaid'])){
$min_quant = $_POST['min'];
echo "<b> Minute Maid (Pulpy Orange): 18 inches pizza</b><br/>Quantity: ".$min_quant."<br/>";
## always wrap var for mathematical calculation with parenthesis
$min_cost = 60 * ( $min_quant);
echo "Price: ".$min_cost."<br/>";
}
$total_gross = (($s1_cost) + ($m1_cost) + ($l1_cost) + ($s2_cost) + ($m2_cost) + ($l2_cost) + ($s3_cost) + ($m3_cost) + ($l3_cost) + ($s4_cost) + ($m4_cost) + ($l4_cost) + ($s5_cost) + ($m5_cost) + ($l5_cost) + ($s6_cost) + ($m6_cost) + ($l6_cost)
+ ($ck_cost) + ($ckz_cost) + ($spr_cost) + ($min_cost));
echo '<br><font color="#FF9331"><b>Total Amount Due: </font></b>';
echo "You must pay: ".$total_gross."<br/>";
echo '<center><h3><font color="#FF800D">Are you sure you want to order these?</font></h3>';
echo '<a href="ordcon.php">Yes, submit the form. </a>';
echo " | ";
echo '<a href="userhome.php" > Let me choose again.</a>';
}
else{
echo "<center><h2>You haven't filled the form correctly.</h2>";
echo "<h3>Note: Be sure you check the pizza inch and input the quantity. </h3>";
echo '<a href="userhome.php" >Im sorry, gonna order again.</a>';
}
?>