Jump to content

switch problem


MrAdam

Recommended Posts

hey everyone. iv got a problem with my switch statement...

switch ($f) {case "add":	addItem();	break;case "remove":	removeItem();	break;case "clear":	clearItems();	break;}

.. i've never tried doing something like that before... but it doesn't seem to work (but gives no errors) .. can anybody see a problem?-Thanks

Link to comment
Share on other sites

I don't see anything wrong with it but try this. I added a default case to see echo a string when $f doesn't match any of the other cases (which sounds like what is happening)

switch ($f) {case "add":	addItem();	break;case "remove":	removeItem();	break;case "clear":	clearItems();	break;default :	echo "value fell through";	break;}

Link to comment
Share on other sites

just for kicks try this

switch ($_GET['f']) {case "add":	addItem();	break;case "remove":	removeItem();	break;case "clear":	clearItems();	break;default :	echo "value fell through";	break;}

it might be an issue with the variable and the querystring being the same name?!? :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...