Jump to content


Photo

Linking inside own file


  • Please log in to reply
3 replies to this topic

#1 XeroXer

XeroXer
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts
  • LocationSweden

Posted 29 July 2006 - 01:20 PM

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)
<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>
(part2)
<?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";
}
?>

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...  ???
// XeroXer

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 29 July 2006 - 01:28 PM

Try a slight change ... switch($_GET['id')) {
Legend has it that reading the manual never killed anyone.
My site

#3 XeroXer

XeroXer
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts
  • LocationSweden

Posted 29 July 2006 - 01:38 PM

Easier than I thought

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

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 29 July 2006 - 02:30 PM

too many thumbs, not enough coffee!!

Glad you caught the typo and solved the problem.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users