• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP querystring

TheOmegaCode

Platinum Member
my querystring looks like this:

index.php?id=main

and my code looks like this:

<?php include('includes/' . $id . '.inc') ?>

so this SHOULD evaluate to main.inc, but it doesnt. the variable is empty and its just .inc

is there another way to get $id out of the querystring? i want my pages to be dynamic so it requests the correct include file, respective to the querystring.
 
Depending on the version of PHP that you're using, you may have to refer to the id variable as $HTTP_GET_VARS['id'] instead of $id... it's something they changed in versions of PHP > 4.something

JW
 
Thanks to JW310 I finally got an answer!

Here is the code I used...

I got it to work! This is the code I used

<?php
if(!$_GET['id']){
include('includes/main.inc');
}
else{
$id = $_GET['id']; include('includes/' . $id . '.inc');
}
?>
 
Back
Top