0

Why when submit is pressed, and number of tickets is 3 or higher I am not geting displayed echo?
echo "You choose $place and $tickets tickets, and you get discount 50%, total price is $totalprice";

Thanks in advance

<?php
$selection=$_POST['selection'];
if(isset($selection) and $selection=="submit"){
$place=$_POST['place'];
$tickets=$_POST['tickets'];
$totalprice = $price * $tickets;






if ($place == balkon) {
$price = 10; }

elseif ($place == prvaloza) {
$price = 8; }

elseif ($place == drugaloza) {
$price = 6; }

elseif ($place == parter) {
$price = 4; }

elseif ($tickets >= 3 ) {

$totalprice = $totalprice / 2;
echo "You choose $place and $tickets tickets, and you get discount 50%, total price is $totalprice";
}


}


?>

<form method=post name=tickets action=''><input type=hidden name=selection value=submit>
<table border="0" cellspacing="0" >
<tr><td  align=left  >   
<select name=place value=''>Choose place</option>
<option value='balkon'>Balkon</option>
<option value='prvaloza'>Prva loza</option>
<option value='drugaloza'>Druga loza</option>
<option value='parter'>Parter</option>

</select>

</td><td  align=left  >   
Broj karata<input type=text name=tickets size=4>
<input type=submit value=Select>


</table>
</form>

Edited by filipgothic

2
Contributors
4
Replies
16
Views
3 Years
Discussion Span
Last Post by filipgothic
1

Line 25 replace elseif to if, lines 13, 16, 19, 22 need quotes like this:
if ($place == 'balkon')

Edited by AndrisP

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.