Inlcuding page code issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
openflame06
Forum Newbie
Posts: 1
Joined: Mon Apr 14, 2008 12:23 am

Inlcuding page code issue

Post by openflame06 »

Code: Select all

<?php 
 
 
$page = $_GET['page'];
 
    if ($page == ""){
        $page = "home";
    }
    
include ("pages/" . $page . ".php");
?>
I am using the above code on my website but I have a problem - I need to create a hyper link to a page that is like this
<a href=\"?page=bands?Result_Set=$Res1\"> but the problem is - the above code puts .php after the file so it effectively turns the href into bands?Result_Set=$Res1.php

Anyone have any ideas on how to get rid of that, I am sure there is something simple but I am failing to find anything currently.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Inlcuding page code issue

Post by Christopher »

I would probably have a second parameter named something like 'query' that contained the query parameters. I hope this script is not on a server on the Internet somewhere. It is very insecure.
(#10850)
Post Reply