|
|
dalka 03-09-2009, 05:57 PM Hi everyone i want to appear my link on the adressbar when i click any link like this:
http://www.domain.com/get-file.php?id=1
E.g my contact link appears like this:
http://www.domain.com/contact.php
here are what i did:
get-file.php
<?php
// get-file.php
// call with: http://domain/get-file.php?id=1
$id = (isset($_GET["id"])) ? strval($_GET["id"]) : "1";
// lookup
$url[1] = 'http://www.domain.com/contact.php';
header("Location: $url[$id]");
exit;
?>
link code:
<a href='http://www.domain.com/get-file.php?id=1'>Contact Us</a>
Can someone help me the right code?
thanks everybody.
Pandabeer 03-09-2009, 06:27 PM <?
$id = $_GET['id']; //you should only allow numbers
If ($_GET['id']==1){
$file = $map.'page1.php'; //this says what the id is
}
else If ($_GET['id']== 2){
$file = $map.'page2.php';
}
else If ($_GET['id'] == 3){
$file = $map.'page3.php';
}
else If ($_GET['id'] == 4){
$file = $map.'page4.php';
}
else {
$file = $map.'page0.php';
}
include($file ); //includes the document the link asked for.
?>
NOT BY ME!!
Source: Click (http://adaox-designs.com/forum/viewtopic.php?f=23&t=134)
dalka 03-09-2009, 07:00 PM :thumbsup:Thanks alot Pandabeer for your right code i works fine and give 1000 thanks
Pandabeer 03-09-2009, 07:24 PM :thumbsup:Thanks alot Pandabeer for your right code i works fine and give 1000 thanks
dont thank me thank the creator of that tut :)
Iszak 03-09-2009, 07:31 PM You could also do..
<?php
$id = $_GET['id'];
$file = $map;
switch ($id)
{
case 1:
$file .= 'page1.php';
break;
case 2:
$file .= 'page2.php';
break;
case 3:
$file .= 'page3.php';
break;
case 4:
$file .= 'page4.php';
break;
default:
$file .= 'page4.php';
break;
}
include $file;
You could even do...
<?php
$id = $_GET['id'];
if (is_readable($map.'page'.$id.'php') === true)
{
// File can't be read / found
include $file;
}
else
{
// Default page
include $map.'page'.$id.'php';
}
Pandabeer 03-09-2009, 08:25 PM You could also do..
<?php
$id = $_GET['id'];
$file = $map;
switch ($id)
{
case 1:
$file .= 'page1.php';
break;
case 2:
$file .= 'page2.php';
break;
case 3:
$file .= 'page3.php';
break;
case 4:
$file .= 'page4.php';
break;
default:
$file .= 'page4.php';
break;
}
include $file;
You could even do...
<?php
$id = $_GET['id'];
if (is_readable($map.'page'.$id.'php') === true)
{
// File can't be read / found
include $file;
}
else
{
// Default page
include $map.'page'.$id.'php';
}
maybe your page's name isn't page[1-10] :p
Iszak 03-09-2009, 08:46 PM I was only using the way you were using Pandabeer, it's not hard to edit it especially the 2nd way.
|
|
|
|
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum
vBulletin® v3.8.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.