Showing game category based on the game selection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phphunger
Forum Commoner
Posts: 45
Joined: Tue Aug 11, 2009 11:56 pm

Showing game category based on the game selection

Post 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..??
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: Showing game category based on the game selection

Post by pbs »

From which page you are getting $_GET['type']
phphunger
Forum Commoner
Posts: 45
Joined: Tue Aug 11, 2009 11:56 pm

Re: Showing game category based on the game selection

Post 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.
phphunger
Forum Commoner
Posts: 45
Joined: Tue Aug 11, 2009 11:56 pm

Re: Showing game category based on the game selection

Post by phphunger »

Hi techies,

Can anyone provide solution for me...
Post Reply