Page 1 of 1

Really wierd problem with include and $_GET

Posted: Tue Jan 31, 2006 2:20 pm
by kaisellgren

Code: Select all

<?php
$siteid = $_GET["siteid"];
if ($siteid = "7")
include("adminmain.php");
?>
That was my code, but when I run the file as "index.php?siteid=4", it will include the adminmain.php file!? Can you notice any bug in my script or custom?

Posted: Tue Jan 31, 2006 2:22 pm
by Burrito
you're setting it to 7...you need to use the comparison operator "=="

ie:

Code: Select all

<?php 
$siteid = $_GET["siteid"]; 
if ($siteid == "7") 
include("adminmain.php"); 
?>

Posted: Tue Jan 31, 2006 2:26 pm
by kaisellgren
Oh damn! That was very fast reply thanks! I have not been using PHP for long time so I don't even remember the basics :S I have been using programming language that doesn't need the double =. Thank you for fast reply!