I'm currently experimenting with PHP GET Requests, But stuck with this. Please remember i haven't really experimented with this. So it's rather now to me,
To the point..
I'm trying to return an invalid argument message if the user does not specify one of the following arguments
Been tinkering with this for quite a bit, But unable to really figure it out.
?param=first or ?param=second
But it returns it returns the valid parameter message anyway. Any suggestions to this? I'll drop my code below!
<?php
$param = $_GET['param'];
if (empty($_GET['param']))
{
print('<h2>Parameter param is not set!<h2>');
print '<br>';
print('<h5><font color="red">Proper usage: http://localhost/zoek.php/?param=first</font></h5>'); //first
print('<h5><font color="red">Or second http://localhost/zoek.php/?param=second</font></h5>'); //second
die();
}
?>
<?php
if ($param == 'first')
{
print('Do something when url = http://localhost/zoek.php/?focus=first');
//do more stuff
}
else if ($param = 'second')
{
print('Do something when url = http://localhost/zoek.php/?focus=second');
//do more stuff.
}
//attempt to return error message when parameter $param is not first or second
else
{
print('The by you specified argument '. $_GET['param'] .' is invalid.');
die();
}
?>