FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


iFrame/Flash





munkey_boy
Hey guys i was just wondering if you could help me with a little php issue. Let me explain.

Ok say if PageA is the directory and PageB is the content viewing page. How can I click a link on PageA labeled "Game 1" and it takes me to PageB and displays "Game1" (somehow displayed) but then I go back to PageA and click a link labeled "Game2" how do i get it to go to PageB but display "Game2"?

If someone could guide me to a tutorial, help me a little bit or even write the script or me (I will pay FRIH$), please post.

Thanks, munkey_boy
sonam
You can use GET command. Eg. link to Game 1 on page1 is:
Code:
http://www.some_domain.com/page2.php?id=1

Code:
$id= $_GET['id'];

if($id == 1) {
... // do some stuff
}


link to Game 2 on page1 is:
Code:
http://www.some_domain.com/page2.php?id=2

Code:
if($id == 2) {
... // do some stuff
}
or together:

Code:
if($id == 1) {
... // do stuff for game 1
} else  {
... // do stuff for game 2
}



Sonam
munkey_boy
So it really is easy?
sonam
Jeah! Peace of cake. Wink

Sonam
munkey_boy
Would you write the script for me, for FRIH$? If you would how much FRIH$ would you charge? Laughing
sonam
No problem, just give me more informations. Names of pages, games, path to games and pages (if they are not in root folder), and of course your domain. Laughing Did you have only two games or more?

Sonam

Price: FREE!
munkey_boy
sonam wrote:
No problem, just give me more informations. Names of pages, games, path to games and pages (if they are not in root folder), and of course your domain. Laughing Did you have only two games or more?

Sonam

Price: FREE!


Wait till you hear the amout of games. Laughing

I actually meant you just write it for 1 or 2 games so i can copy, paste and edit the code there's about 130 bits of content. Content being games, images, movies and jokes. It's for www.echogames.net , I am making a PSP version of it. I am the Head of Content there. Dancing
sonam
But how I see your site is working in right way. 100% like you asking - click on page A open page B and display chosen game (or something other). Maybe, I don't understand what do you want to change. Confused

Sonam
munkey_boy
sonam wrote:
But how I see your site is working in right way. 100% like you asking - click on page A open page B and display chosen game (or something other). Maybe, I don't understand what do you want to change. Confused

Sonam


I don't i'm making a clone of the site for the PSP. But i'm doing it myself.

Pictures are below.Razz

Scrolled up.


Scrolled down.
sonam
Code:
<?php
$n = $_GET['id'];
switch($n) {
        case "1": include_once $_SERVER["DOCUMENT_ROOT"] . "/games/game1"; break;
        case "2": include_once $_SERVER["DOCUMENT_ROOT"] . "/games/game2"; break;
        case "3": include_once $_SERVER["DOCUMENT_ROOT"] . "/games/game3"; break;

        default: "";
    }
?>


This is basic code. If you want to include more games just copy/paste one line and change case and game number. For default you can put any game.
munkey_boy
Could you explain a little more.
sonam
Quote:
$n = $_GET['id']; //get id (what means number of game)


What's mean if you type link e.g.
Quote:
http://www.some_domain/pageB.php?id=1


first statment in case/switch function will include first game. You just need properly set path to your games.

include_once $_SERVER["DOCUMENT_ROOT"] is your root folder and
"/games/game1"; are path to your game 1

Read more about case/switch function on:
http://hudzilla.org/phpwiki/index.php?title=Case_switching

Sonam
munkey_boy
Ok, thanks I understand now. Thanks for all the help. Razz
sonam
Cool

If you need any other help with this script just post here or PM me. Very Happy

Sonam
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.