Skip to content

Instantly share code, notes, and snippets.

@safranck
Created February 22, 2015 05:35
Show Gist options
  • Save safranck/a164ef9dfc711e2b7046 to your computer and use it in GitHub Desktop.
Save safranck/a164ef9dfc711e2b7046 to your computer and use it in GitHub Desktop.
Form Navigation
<?php
$chapter = ( $_POST[ 'chapter' ] );
?>
<h1><?php echo ucwords( $chapter ); ?></h1>
<h2>Please select a chapter below:</h2>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<select name="chapter">
<option value="appetizers">Appetizers</option>
<option value="main dishes">Main Dishes</option>
<option value="cocktails">Cocktails</option>
<option value="desserts">Deserts</option>
</select>
<input type="submit" value="Submit">
</form>
<?php
if ($chapter == 'appetizers' ) {
include 'appetizer.php';
} elseif ($chapter == 'main dishes' ) {
include 'main.php';
} elseif ( $chapter == 'cocktails' ) {
include 'cocktails.php';
} elseif ($chapter == 'desserts' ) {
include 'desserts.php';
} else {
echo 'Please select a chapter from above';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment