Problem with Switch Statement
Posted by: wilfred_phang (---.115.in-addr.arpa)
Date: January 27, 2009 12:29PM

Hi, i tested for an switch statement example, but i encountered error.

<html>
<body>

<?php
switch ($x)
{
case 1:
echo "Number 1";
break;
case 2:
echo "Number 2";
break;
case 3:
echo "Number 3";
break;
default:
echo "No number between 1 and 3";
}
?>

</body>
</html>


The error message is as below:
Notice: Undefined variable: x in C:\wamp\www\W3C\w3c.php on line 7

Notice: Undefined variable: x in C:\wamp\www\W3C\w3c.php on line 10

Notice: Undefined variable: x in C:\wamp\www\W3C\w3c.php on line 13
No number between 1 and 3


Anybody can tell me how to solve this?
Thanks!

Options: ReplyQuote
Re: Problem with Switch Statement
Posted by: yfastud (Moderator)
Date: January 27, 2009 02:27PM

it's just warn undefine var, not actually error ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: Problem with Switch Statement
Posted by: wilfred_phang (---.115.in-addr.arpa)
Date: January 27, 2009 02:34PM

Thx!!

Options: ReplyQuote


Sorry, only registered users may post in this forum.