I don't see anything wrong with the switch() statements you've been posting... it's just that you haven't defined the variables being examined. For example, where does $x get defined? Or $country in your previous example?
You tell me, the book certainly does not!! The book just shows me a bit of switch statement code (literally) that does nothing 😃
If it's supposed to come from external data, then define the variable before the switch() statement and it should work fine.
How I am i supposed to know this, should the example not come with external data already which I can copy, and play with? I expect an example code to be complete. it's no good a book explaining how a statement works if there is no real world example to show how the code would be used.
Notice: Undefined variable: x in C:\wamp\www\new 2.php on line 7
Notice: Undefined variable: x in C:\wamp\www\new 2.php on line 10
Notice: Undefined variable: x in C:\wamp\www\new 2.php on line 13
No number between 1 and 3
I get the above errors because as you mentioned the variables have not been defined which perhaps could/should have come from a HTML form?
I want an example that is complete, with a form etc. After all I am a beginner: confused:
Sorry, I am sounding like a right spoilt brat, just frustrated that I have a book that is not very useful at all.
Thanks for your help and patients:-)