What validation code should I use to return a FALSE when ALL the data received via
$_GET[‘group’],
$_GET[‘chapter’]
$_GET[‘article’]
does NOT MATCH with the $laws[$group][$chapter][$article] Multidimensional array already set?
I ask because I intend to echo back one article at a time in $laws multidimensional array, for which if such an array construction does not exist, an error returns.
Thanks a lot!
<?php
session_start();
$laws = array(
"group1" => array(
"1" => array(
"1" => "This is article (1) in chapter (1) of (group1)",
"2" => "This is article (2) in chapter (1) of (group1)",
"3" => "This is article (3) in chapter (1) of (group1)",
),
"2" => array(
"1" => "This is article (1) in chapter (2) of (group1)",
"2" => "This is article (2) in chapter (2) of (group1)",
"3" => "This is article (3) in chapter (2) of (group1)",
),
),
"group2" => array(
"1" => array(
"1" => "This is article (1) in chapter (1) of (group2)",
"2" => "This is article (2) in chapter (1) of (group2)",
"3" => "This is article (3) in chapter (1) of (group2)",
),
"2" => array(
"1" => "This is article (1) in chapter (2) of (group2)",
"2" => "This is article (2) in chapter (2) of (group2)",
"3" => "This is article (3) in chapter (2) of (group2)",
),
)
);
$_SESSION['group'] = $_GET['group'];
$_SESSION['chapter'] = $_GET['chapter'];
$_SESSION['article'] = $_GET['article'];
$group = $_SESSION['group'];
$chapter = $_SESSION['chapter'];
$article = $_SESSION['article'];
// Echo Article from $laws multidimensional Array
echo $laws[$group][$chapter][$article];
?>
If you want to return FALSE when ALL the data received does not match:
But I think you want to return FALSE when ANY of the data received does not match, you should then use: