Jump to content

Archived

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

XeroXer

Linking inside own file

Recommended Posts

Hello again.
Back with another problem.
I want to make my guestbook into only one file.
Therefore I want to link inside the own file.
So I took from a tutorial this code:
(part1)
[code]<a href="index.php">default</a>
<a href="index.php?id=1">id 1</a>
<a href="index.php?id=2">id 2</a>
<a href="index.php?id=3">id 3</a>[/code]
(part2)
[code]<?php
switch($id) {
case 1:
echo "Number 1";
break;
case 2:
echo "Number 2";
break;
case 3:
echo "Number 3";
break;
default:
echo "No number between 1 and 3";
}
?>[/code]

They said it should work on the site.
But regardless of what link I press the result always ends up with the default.
So is there another way this should be done.
I just need to get my guestbook into one file. :-)

Please help...  ???

Share this post


Link to post
Share on other sites
Try a slight change ... switch($_GET['id')) {

Share this post


Link to post
Share on other sites
Easier than I thought

Thanks a lot...
Though it should be $_GET['id'] and not $_GET['id')... :-)

Share this post


Link to post
Share on other sites
too many thumbs, not enough coffee!!

Glad you caught the typo and solved the problem.

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.