Hi I have a form that is popluated from the database now I am trying to get the switch case to be based on the option the user selects is this possible to make a case a variable popluated by the drop down if so can someone show me what am i missing?
the value I am trying to get from the form to the switch case is the ( $val->slug) but the value not been set help please
Hi thanks for your response. I actually did look at the link you sent me before unfortunnaly the drop down option values is also populated by from the database so I do not want to everytime i create a new location I have to go in the code and add if location = france else location= england, i do not want to do that every single time so I want the case “$variable” so that whatver is on the options and selected will populate that case inside the switch function.
($val->slug) I want this variable on the switch case, if thats is possible like the one bellow
one problem
Although those values are in the database but you still should have a list of all the known values.
What you need to do is put each one of those values in a case statement and to provide the appropriated code for it. The list maybe long if you were to include all the countries in the world. Or you could just process those that that are important like this:
Thanks for the help guys, tom8 yeah the if statment is working exacly how I thought I could achieve with the switch statment, it is exacly how I wanted Thanks for all the help everybody.