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>

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

alright I fixed, thanks, but now for totalprice I always get 0

Cut and paste line 6 after the line 23

thanks a lot, solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.