i want my url to look like .com/?id=page
I have tried this script
<html>
<head>
<title>Switch Example</title>
</head>
<body>
<?php
switch($_GET['id']){
case 'article1' :
include('article1.php');
break;
}
?><a href=http://www.htmlforums.com/archive/index.php/"?id=article1">link</a>
</body>
</html>
but it doesnt work for me, can anyone set me on track?Are you sure your webhost supports PHP? If you view the page and choose View->Source, can you see the PHP part?its ok ive solved the problem now Hi,
Try this code, it's what I use.
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}
switch ($page) {
case 'contact':
include 'includes/contact.php';
break;
default:
include 'includes/main.php';
?>
Just change the id= to page=
And make sure your server does support php, like agent said.
EDIT: oops, it looks like you solved it. What was the problem?I just decided to use a different code.
<?php
if($_GET['id'] == 'page'){
;
}
?>
and the links are
<a href=http://www.htmlforums.com/archive/index.php/"?id=page">Link</a>
thanks for replying anyway though this code may be unsecure, if i understood it right...
someone might run yourpage.com/?id=http://www.somebadsite.com/somebadscript.php and that aint very secure...
I have tried this script
<html>
<head>
<title>Switch Example</title>
</head>
<body>
<?php
switch($_GET['id']){
case 'article1' :
include('article1.php');
break;
}
?><a href=http://www.htmlforums.com/archive/index.php/"?id=article1">link</a>
</body>
</html>
but it doesnt work for me, can anyone set me on track?Are you sure your webhost supports PHP? If you view the page and choose View->Source, can you see the PHP part?its ok ive solved the problem now Hi,
Try this code, it's what I use.
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}
switch ($page) {
case 'contact':
include 'includes/contact.php';
break;
default:
include 'includes/main.php';
?>
Just change the id= to page=
And make sure your server does support php, like agent said.
EDIT: oops, it looks like you solved it. What was the problem?I just decided to use a different code.
<?php
if($_GET['id'] == 'page'){
;
}
?>
and the links are
<a href=http://www.htmlforums.com/archive/index.php/"?id=page">Link</a>
thanks for replying anyway though this code may be unsecure, if i understood it right...
someone might run yourpage.com/?id=http://www.somebadsite.com/somebadscript.php and that aint very secure...