Jump to content

Archived

This topic is now archived and is closed to further replies.

Demorgon

Using $action - Newb Question - [DONE]

Recommended Posts

As in the Subject... I am not familair with PHP at all I'm a major newb.. But my question is how can I achieve  what I have explained below.

I already created my php page -> maps.php

I have a list of games and instead of loading another page I was wondering what tags ect... I could use so that it could be like below.

Lets say one of the links is for - Quake so I would like the link to read --> maps.php?action=quake

I do not want to use a database for this I just was hoping each Game Map page code could be contained within the maps.php but not viewed untill the maps.php?action=quake link is clicked..

I'm not sure if this is the correct way to do what I'm asking but anything close would be a great help...

Thanks in advance.


{EDIT}

I apolagize MODS I overlooked it in the PHP F.A.Q. - Feel free to delete this thread... Again sorry.  :-\

Share this post


Link to post
Share on other sites
[code]<?php

$action = $_GET["action"];

switch($action) {
    case "quake":
//include content for quake page
break;

    case "doom":
//include content for doom page
break;

    default:
//Show default page
break;
}

?>[/code]

For easier content management I would suggest creating separate pages with the actual content and just including the appropriate content pages within the select statement. Be sure to put whatever common content the pages will have on this page before and after the select, but just put the different content into separate pages.

Share this post


Link to post
Share on other sites
Hey thanxs I was thinking of using the "$_GET superglobals" but this will work aswell.... Thank you so much bro!  :D

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.