Skip to content
Advertisement

Using GET to correlate with switch statement

I’m trying to use a switch statement to execute a section of code to run a query to generate an html list. I would like use the get value from the URL to correlate with the switch statement IE list.php?=types would run the query and script to generate the html table for types. But I can’t quite figure out how it make it work. Any help would be appreciated.

list.php

JavaScript

Advertisement

Answer

Just use the $_GET superglobal. https://www.php.net/manual/en/reserved.variables.get.php

?type=roads

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement