I have created two pages: sample.php and process.php with the following code on each.
[php]
Group: Group1 Group2Chapter:
<input type="text" name="chapter">
Article:
<input type="text" name="article">
<input type="submit" value="Go to Article">
[/php]
[php]
<?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)", ), ) ); /* (QUSTION 1) Before setting $_SESSION values with data from $_GET variables, how do I validate the $_GET values from the form with the following scheme? Data in CHAPTER and ARTICLE input forms: are not empty; are numbers; are not less than or greater than the existing array Chapters and Verses; do not have spaces; do not have decimals; do not have letters; do not have negative, positive and; or other signs; */ $_SESSION['group'] = $_GET['group']; $_SESSION['chapter'] = $_GET['chapter']; $_SESSION['article'] = $_GET['article']; $group = $_SESSION['group']; $chapter = $_SESSION['chapter']; $article = $_SESSION['article']; ?> <?php // Echo Article from Laws Array echo $group . " chapter" . $chapter . " article" . $article . ""; echo $laws[$group][$chapter][$article]; ?>
PREVIOUS Articles NEXT Articles
[/php]
Thank You!