I have a web page that should only be accessed if a 'Get' variable is set in the url. I use the isset function to check for the variable. If the variable is not set I want to redirect to another page.
My main page has the following code
//index.php
<!DOCTYPE html>
<?php
require("php/loadSurvey.php");
require("php/saveSurvey.php");
checkGet();
?>
<html>
<head>
//some html stuff and closing tags
checkGet is a php function defined in loadSurvey.php:
//php/loadSurvey.php
function checkGet()
{
if(!isset($_GET['ID']))
{
header("Location: http://kristophertadlock.com/passcode.php", true, 303);
die();
}
}
The index page should redirect to this page
//passcode.php
<!DOCTYPE html>
<html>
<p>
you got here
</p>
</html>
passcode.php exist in the same directory as the index.php. When I using something like mydomain/$ID=1 I get the web page to load just like it should. When I using something like mydomain/ I get a blank page instead of redirecting to my passcode page. Does anyone know what I am doing wrong? Thank you.