This has been playing on my mind for a while, I need to check that the user has entered the correct parameters, how do I do check this in an if statement in php? Users enters as follows;
www.domain.com/?amnt=100&from=AAA&to=BBB
so I need to check if they enter something as follows;
www.domain.com/?xxx=100&yyy=AAA&to=BBB
/////// Code is now as follows;
//1000 Required parameter is missing
if ($amnt == null || $from==null || $to==null) {
$error_code = 1000;
$returnXML = new XML();
$returnXML->CreateError($error_code,$error_msg[$error_code]);
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=error.xml">';
exit;
}
//1100 Parameter not recognized
if(!isset($_GET['amnt'], $_GET['from'], $_GET['to']))
{
$error_code = 1100;
$returnXML = new XML();
$returnXML->CreateError($error_code,$error_msg[$error_code]);
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=error.xml">';
exit;
}
it returns the first IF when I request ../?xxx=100&yyy=GBP&to=USD, it makes logical sense, but how do I get it to return the second IF, if the parameters are not entered?