Jump to content

Archived

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

perezf

php change address bar text

Recommended Posts

how is it possible to change what is displayed in the address bar
for instance from [site.com/games.php] to a [site.com/?page=games]

Share this post


Link to post
Share on other sites
Yes you can do it. You will still have to make both pages

you will have to have at least one page show. like

[a href=\"http://site.com/index.php?page=games\" target=\"_blank\"]http://site.com/index.php?page=games[/a]

The on the index page all you need to do is include the page

index.php
[code]<?
include(''.$_GET['page'].'.php');
?>[/code]

Ray

Share this post


Link to post
Share on other sites
[!--quoteo(post=359800:date=Mar 29 2006, 03:29 PM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Mar 29 2006, 03:29 PM) [snapback]359800[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Yes you can do it. You will still have to make both pages

you will have to have at least one page show. like

[a href=\"http://site.com/index.php?page=games\" target=\"_blank\"]http://site.com/index.php?page=games[/a]

The on the index page all you need to do is include the page

index.php
[code]<?
include(''.$_GET['page'].'.php');
?>[/code]

Ray
[/quote]


im not really understanding what your trying to say

Share this post


Link to post
Share on other sites
$_GET is a global array that grabs information out of the URL. If someone goes to your site or clicks on a link from your site with the following address: "mysite.com/index.php?page=123" then you're going to find "123" in the variable: $_GET['page'].

So in your index page, you need to handle that:

[code]<?php
if(isset($_REQUEST['page']))
{
    switch($_GET['page'])
    {  
          case "123":
                include("page123.php");
          break;
          case "foo":
                include("foobar.php");
          break;
}
else
    include("main.php");
?>[/code]

Does that help? Also, please do not bump your thread 12 minutes after posting a question. Someone will get to it.

Share this post


Link to post
Share on other sites
[!--quoteo(post=359804:date=Mar 29 2006, 03:35 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Mar 29 2006, 03:35 PM) [snapback]359804[/snapback][/div][div class=\'quotemain\'][!--quotec--]
$_GET is a global array that grabs information out of the URL. If someone goes to your site or clicks on a link from your site with the following address: "mysite.com/index.php?page=123" then you're going to find "123" in the variable: $_GET['page'].

So in your index page, you need to handle that:

[code]<?php
if(isset($_REQUEST['page']))
{
    switch($_GET['page'])
    {  
          case "123":
                include("page123.php");
          break;
          case "foo":
                include("foobar.php");
          break;
}
else
    include("main.php");
?>[/code]

Does that help? Also, please do not bump your thread 12 minutes after posting a question. Someone will get to it.
[/quote]

im not really understanding on how i can link this code to my links

Share this post


Link to post
Share on other sites
is there a tutorial anywhere that would show me step by step

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.