Page 1 of 1

Showing game category based on the game selection

Posted: Wed Mar 10, 2010 4:49 am
by phphunger
Hi,

First of all i will tell you my assignment. I have some 4 categories like Action Games, Adventure Games, Shooting Games, Casino Games. When i click on the game i want to show the game name from which category that game belongs. For example i have selected a game from "New Games" in those new games category..there are many games which belongs to different categories like Action Games, Adventure Games, Shooting Games, Casino Games. If i select a game then the result should be like "Action" Game if it belongs to action game category. etc...

I have coded the following:

Code: Select all

<?php echo $playGameRow['name'];?> - Free Online <?php
                
              if ($_GET['type'] == "action"){
              echo "Action Games";
              }
              elseif ($_GET['type'] == "arcade"){
              echo "Arcade Games";
              }
              elseif ($_GET['type'] == "adventure"){
              echo "Adventure Games";
              }
              elseif ($_GET['type'] == "puzzle"){
              echo "Puzzle Games";
              }
              elseif ($_GET['type'] == "fighting"){
              echo "Fighting Games";
              }
              elseif ($_GET['type'] == "shooting"){
              echo "Shooting Games";
              }
              elseif ($_GET['type'] == "racing"){
              echo "Racing Games";
              }
              elseif ($_GET['type'] == "sports"){
              echo "Sports Games";
              }
              elseif ($_GET['type'] == "strategy"){
              echo "Strategy Games";
              }
              elseif ($_GET['type'] == "casino"){
              echo "Caisno Games";
              }
              else{
              echo "Recent Games";
              }
 
The problem with the above code is whatever the game i selected it shows "Recent Games"..

In my database table i have columns as ID, Name, type etc...

Can anyone provide solution for this..??

Re: Showing game category based on the game selection

Posted: Wed Mar 10, 2010 6:15 am
by pbs
From which page you are getting $_GET['type']

Re: Showing game category based on the game selection

Posted: Wed Mar 10, 2010 6:28 am
by phphunger
Hi pbs,

Thanks for your response..
I have 2 pages play.php and show_more.php....$_GET['type'] is there in the show_more.php.

Re: Showing game category based on the game selection

Posted: Thu Mar 11, 2010 4:37 am
by phphunger
Hi techies,

Can anyone provide solution for me...