careym1989 Posted December 23, 2008 Share Posted December 23, 2008 Hello Everyone! I had a brief question on commands in the URL. My main this is that I want to cut down on pages needed by using one page and a command in the URL. For EG: Test_Page.php?cmd=Add or Test_Page.php?cmd=Del&id=$id or Test_Page.php?cmd=Edit&id=$id How would I go about adding in the cmd= function so that I can use 1 page to add, delete, and edit? I could really use some help here, lol! Been trying to figure this out for a while now. I can elaborate if needed, but basically I want this page to add, edit, and delete (for edit & delete it would be followed by &id=$id. I can do that part, though. I just need to be able to get the cmd part of the url in there. Thanks so much! -Carey Link to comment https://forums.phpfreaks.com/topic/138099-commands-in-url/ Share on other sites More sharing options...
trq Posted December 23, 2008 Share Posted December 23, 2008 if (isset($_GET['cmd'])) { switch ($_GET['cmd']) { case 'add': echo "do add stuff here"; break; case 'del': echo "do delete stuff here"; break; case 'edit': echo "do edit stuff here"; break; default: echo "some default action"; } } Link to comment https://forums.phpfreaks.com/topic/138099-commands-in-url/#findComment-721894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.