Skip to content

Instantly share code, notes, and snippets.

@safranck
Created February 21, 2015 22:36
Show Gist options
  • Save safranck/df87b40669f2bddb107e to your computer and use it in GitHub Desktop.
Save safranck/df87b40669f2bddb107e to your computer and use it in GitHub Desktop.
PHP 201
<?php
require 'inc-header.php';
$chapter = ( $_GET[ 'chapter' ] );
?>
<h3>Today is <?php echo myDate(); ?>.</h3>
<h1><?php echo ucwords( $chapter ); ?></h1>
<h2>Please select a chapter below:</h2>
<form action="/201.php" method="get">
<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';
}
echo '<h3>While...loop example</h3>';
$counter = 1;
while( $counter <= 3 ) {
echo "The number is: $counter </br>";
$counter++;
}
?>
<?php
require 'inc-footer.php';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment