-   Programming (
-   -   Suggest a PHP snippet for 2/3 tier menu (

ludo33 11-29-2009 02:26 AM

Suggest a PHP snippet for 2/3 tier menu

I'm looking for a simple php snippet or jquery example that would implement a 2 or maybe 3 tier navigation menu from an array. I've looked about the net but many of them seem insecure ie liberal use of the $_GET tag

Something like:


Clicking on cats would take you to a page with siamese manx....
Clicking on Dogs would take you to Pedigree Mongrel then on to corgi, alsation..

Better to ask first than be sorry later!

Thanks in advance good folks...


Robhogg 11-30-2009 11:18 AM

What is it that you perceive as insecure about the use of the $_GET array?

If it is being used to change the state of the server (e.g. inserting data into a database), then that is not a good idea. However, if it is being used to select what content to display and/or how to display it, then, as I see it, this is exactly what $_GET is for.

The advantages of using the $_GET array are simplicity, and that a static URL is automatically provided to the user (e.g., allowing them to link to / bookmark the page. The exception might be a page that you do not want someone to be able to go to directly (e.g. one requiring login). Using it for indicating what menu/submenu to display isn't much different, IMHO (.../page.php?cat=cat&subcat=siamese).

ludo33 12-01-2009 04:34 AM

For you reply, I have read a lot about incorrect use of $_GET and the dangers held within. Now, thanks to your reply I now know why!

Siamese cats here I come!

All times are GMT -5. The time now is 02:19 PM.