It is display $x as undefined. What is wrong with my switch statement?
http://localhost/add.php?price_error=1
switch(isset($_GET['price_error']) && $_GET['price_error'] == $x){
case 1:
echo '<span class="error_msg">Discount price cannot be greater than original price</span><br/>';
break;
case 2:
echo '<span class="error_msg">Discount cannot be less than 30% of original price</span><br/>';
break;
case 3:
echo '<span class="error_msg">Discount price and original price cannot be greater than $30000 HKD</span><br/>';
break;
default:
false;
break;
}
Switches typically have variable parameters.
Try: