Skip to content

Commit

Permalink
updates as i write
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryUllman committed May 7, 2017
1 parent feae1d0 commit 5d25477
Show file tree
Hide file tree
Showing 42 changed files with 190 additions and 304 deletions.
2 changes: 1 addition & 1 deletion ch01/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?php

# Script 1.4 - comments.php
# Created March 16, 2011
# Created April 23, 2017
# Created by Larry E. Ullman
# This script does nothing much.

Expand Down
4 changes: 2 additions & 2 deletions ch02/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// for an HTML form: months, days, years.

// Make the months array:
$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$months = [1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

// Make the months pull-down menu:
echo '<select name="month">';
Expand All @@ -30,7 +30,7 @@

// Make the years pull-down menu:
echo '<select name="year">';
for ($year = 2011; $year <= 2021; $year++) {
for ($year = 2017; $year <= 2027; $year++) {
echo "<option value=\"$year\">$year</option>\n";
}
echo '</select>';
Expand Down
2 changes: 1 addition & 1 deletion ch02/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<p><label>Name: <input type="text" name="name" size="20" maxlength="40"></label></p>

<p><label>Email Address: <input type="text" name="email" size="40" maxlength="60"></label></p>
<p><label>Email Address: <input type="email" name="email" size="40" maxlength="60"></label></p>

<p><label for="gender">Gender: </label><input type="radio" name="gender" value="M"> Male <input type="radio" name="gender" value="F"> Female</p>

Expand Down
4 changes: 2 additions & 2 deletions ch02/handle_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// Print the submitted information:
if ( !empty($_POST['name']) && !empty($_POST['comments']) && !empty($_POST['email']) ) {
echo "<p>Thank you, <strong>{$_POST['name']}</strong>, for the following comments:<br>
<tt>{$_POST['comments']}</tt></p>
<p>We will reply to you at <i>{$_POST['email']}</i>.</p>\n";
<pre>{$_POST['comments']}</pre></p>
<p>We will reply to you at <em>{$_POST['email']}</em>.</p>\n";
} else { // Missing form value.
echo '<p>Please go back and fill out the form again.</p>';
}
Expand Down
34 changes: 17 additions & 17 deletions ch02/multi.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@

// Create one array:
$mexico = array(
'YU' => 'Yucatan',
'BC' => 'Baja California',
'OA' => 'Oaxaca'
'YU' => 'Yucatan',
'BC' => 'Baja California',
'OA' => 'Oaxaca'
);

// Create another array:
$us = array (
'MD' => 'Maryland',
'IL' => 'Illinois',
'PA' => 'Pennsylvania',
'IA' => 'Iowa'
$us = array(
'MD' => 'Maryland',
'IL' => 'Illinois',
'PA' => 'Pennsylvania',
'IA' => 'Iowa'
);

// Create a third array:
$canada = array (
'QC' => 'Quebec',
'AB' => 'Alberta',
'NT' => 'Northwest Territories',
'YT' => 'Yukon',
'PE' => 'Prince Edward Island'
$canada = array(
'QC' => 'Quebec',
'AB' => 'Alberta',
'NT' => 'Northwest Territories',
'YT' => 'Yukon',
'PE' => 'Prince Edward Island'
);

// Combine the arrays:
$n_america = array(
'Mexico' => $mexico,
'United States' => $us,
'Canada' => $canada
'Mexico' => $mexico,
'United States' => $us,
'Canada' => $canada
);

// Loop through the countries:
Expand Down
4 changes: 2 additions & 2 deletions ch02/script_02_02/handle_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

// Print the submitted information:
echo "<p>Thank you, <strong>$name</strong>, for the following comments:<br>
<tt>$comments</tt></p>
<p>We will reply to you at <i>$email</i>.</p>\n";
<pre>$comments</pre></p>
<p>We will reply to you at <em>$email</em>.</p>\n";

?>
</body>
Expand Down
2 changes: 1 addition & 1 deletion ch02/script_02_03/handle_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// Print the submitted information:
echo "<p>Thank you, <strong>$name</strong>, for the following comments:<br>
<tt>$comments</tt></p>
<p>We will reply to you at <i>$email</i>.</p>\n";
<p>We will reply to you at <em>$email</em>.</p>\n";

// Print a message based upon the gender value:
if ($gender == 'M') {
Expand Down
4 changes: 2 additions & 2 deletions ch02/script_02_04/handle_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
if ($name && $email && $gender && $comments) {

echo "<p>Thank you, <strong>$name</strong>, for the following comments:<br>
<tt>$comments</tt></p>
<p>We will reply to you at <i>$email</i>.</p>\n";
<pre>$comments</pre></p>
<p>We will reply to you at <em>$email</em>.</p>\n";

echo $greeting;

Expand Down
6 changes: 3 additions & 3 deletions ch02/script_02_06/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// for an HTML form: months, days, years.

// Make the months array:
$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$months = [1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

// Make the days and years arrays:
$days = range (1, 31);
$years = range (2011, 2021);
$days = range(1, 31);
$years = range(2017, 2027);

// Make the months pull-down menu:
echo '<select name="month">';
Expand Down
24 changes: 14 additions & 10 deletions ch02/sorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@
</head>
<body>
<table border="0" cellspacing="3" cellpadding="3" align="center">
<thead>
<tr>
<td><h2>Rating</h2></td>
<td><h2>Title</h2></td>
<th><h2>Rating</h2></th>
<th><h2>Title</h2></th>
</tr>
</thead>
<tbody>
<?php # Script 2.8 - sorting.php

// Create the array:
$movies = array (
'Casablanca' => 10,
'To Kill a Mockingbird' => 10,
'The English Patient' => 2,
'Stranger Than Fiction' => 9,
'Story of the Weeping Camel' => 5,
'Donnie Darko' => 7
);
$movies = [
'Casablanca' => 10,
'To Kill a Mockingbird' => 10,
'The English Patient' => 2,
'Stranger Than Fiction' => 9,
'Story of the Weeping Camel' => 5,
'Donnie Darko' => 7
];

// Display the movies in their original order:
echo '<tr><td colspan="2"><strong>In their original order:</strong></td></tr>';
Expand All @@ -46,6 +49,7 @@
}

?>
</tbody>
</table>
</body>
</html>
4 changes: 2 additions & 2 deletions ch03/calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function calculate_trip_cost($miles, $mpg, $ppg) {
} // End of calculate_trip_cost() function.

$page_title = 'Trip Cost Calculator';
include ('includes/header.html');
include('includes/header.html');

// Check for form submission:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
Expand Down Expand Up @@ -81,4 +81,4 @@ function calculate_trip_cost($miles, $mpg, $ppg) {
<p><input type="submit" name="submit" value="Calculate!"></p>
</form>

<?php include ('includes/footer.html'); ?>
<?php include('includes/footer.html'); ?>
9 changes: 5 additions & 4 deletions ch03/includes/footer.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!-- Script 3.3 - footer.html -->
<!-- End of the page-specific content. --></div>
<div id="footer">
<p>Copyright &copy; <a href="#">Plain and Simple</a> 2007 | Designed by <a href="http://www.edg3.co.uk/">edg3.co.uk</a> | Sponsored by <a href="http://www.opendesigns.org/">Open Designs</a> | Valid <a href="http://jigsaw.w3.org/css-validator/">CSS</a> &amp; <a href="http://validator.w3.org/">XHTML</a></p>
</div>
<footer class="footer">
<div class="container">
<p class="text-muted"><p>Copyright &copy; 2017</p>
</div>
</footer>
</body>
</html>
36 changes: 19 additions & 17 deletions ch03/includes/header.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php echo $page_title; ?></title>
<link rel="stylesheet" href="includes/style.css" type="text/css" media="screen">
<meta charset="utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $page_title; ?></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="css/sticky-footer-navbar.css" rel="stylesheet">
</head>
<body>
<div id="header">
<h1>Your Website</h1>
<h2>catchy slogan...</h2>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header"><a class="navbar-brand" href="#">Your Website</a></div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.php">Home</a></li>
<li><a href="calculator.php">Calculator</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div>
<div id="navigation">
<ul>
<li><a href="index.php">Home Page</a></li>
<li><a href="calculator.php">Calculator</a></li>
<li><a href="#">link three</a></li>
<li><a href="#">link four</a></li>
<li><a href="#">link five</a></li>
</ul>
</div>
<div id="content"><!-- Start of the page-specific content. -->
</nav>
<div class="container">
<!-- Script 3.2 - header.html -->
121 changes: 0 additions & 121 deletions ch03/includes/style.css

This file was deleted.

Loading

0 comments on commit 5d25477

Please sign in to comment.