Code: Select all
<?
if($view == "") {
$view = "main";
}
include "$view.php";
?>
Thanks in advance for the help!
Moderator: General Moderators
Code: Select all
<?
if($view == "") {
$view = "main";
}
include "$view.php";
?>
Remix919 wrote:Hey guys, I used to know a lot about php code and wrote several games, but haven't used php in quite some years. I was recently building a website and just needed a simple if then statement, here's my code:The problem is that it'll replace the $view variable and display the main.php easily, but when I use the url like index.php?view=somepage, it won't display it, it won't even show up the $view variable when I echo it. I was just wondering if there's been some major changes to PHP lately to the point where I can't pass a variable through a URL? I have PHP ver 5.2.5.Code: Select all
<? if($view == "") { $view = "main"; } include "$view.php"; ?>
Thanks in advance for the help!
Code: Select all
<?php
$view=$_GET['view'];
if($view=="")
{
$view="main";
}
include($view.".php");
?>