Jump to content


Photo

Using $action - Newb Question - [DONE]


  • Please log in to reply
2 replies to this topic

#1 Demorgon

Demorgon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 26 October 2006 - 10:15 PM

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.  :-\

#2 Psycho

Psycho
  • Moderators
  • Move along, nothing to see here
  • 11,891 posts
  • LocationCanada

Posted 26 October 2006 - 10:23 PM

<?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;
}

?>

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.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#3 Demorgon

Demorgon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 26 October 2006 - 10:37 PM

Hey thanxs I was thinking of using the "$_GET superglobals" but this will work aswell.... Thank you so much bro!  :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users