Jump to content

[SOLVED] Showing a page


cheechm

Recommended Posts

Hi,

I am trying to show a different pages using this script:

 

<?php 
switch($id) { default: include('filename.php');
break; case "1": include('filename1.php');
break; case "2": include('filename2.php');
break; case "3": include('filename3.php');
break; case "4": include('filename4.php');
break; case "5": include('filename5.php');
break; case "6": include('filename6.php');
break; case "7": include('filename7.php');
} 
?> 

 

But whenever I try for instance

http://mysite.com/filename.php?id=1

I always end up with the contents of filename.php, not filename1.php .

 

Link to comment
https://forums.phpfreaks.com/topic/50265-solved-showing-a-page/
Share on other sites

have you used $id = $_GET['id']?

 

<?php 
$id = $_GET['id'];
switch($id) { default: include('filename.php');
break; case "1": include('filename1.php');
break; case "2": include('filename2.php');
break; case "3": include('filename3.php');
break; case "4": include('filename4.php');
break; case "5": include('filename5.php');
break; case "6": include('filename6.php');
break; case "7": include('filename7.php');
} 
?> 

Link to comment
https://forums.phpfreaks.com/topic/50265-solved-showing-a-page/#findComment-246732
Share on other sites

Archived

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

×
×
  • Create New...

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.