A problem with the switch statement
Posted: Sat Feb 28, 2009 1:53 pm
Hello. I am reading the book PHP and MySQL Web Development and I am doing the exercise with the switch statement. I have copied the text, double-checked it and still I get mistakes. Here is the code:
The $find variable takes data from an select tag with possible values :a,b,c,d. I am using netbeans and it says:
Syntax error:
expected: exit,if...and so on.
What am I doing wrong ?
Code: Select all
switch($find)
{
case:'a' :
echo '<p>Regular customer</p>';
break;
case:'b' :
echo '<p>tv</p>';
break;
case:'c' :
echo '<p>i-net</p>';
break;
case:'d' :
echo '<p>word of mouth</p>';
break;
default:
echo 'Why don\'t know';
break;
}Syntax error:
expected: exit,if...and so on.
What am I doing wrong ?