Skip to content

Commit

Permalink
last edits
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryUllman committed Nov 11, 2017
1 parent 65a7b2d commit 5118f2b
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 27 deletions.
12 changes: 12 additions & 0 deletions ch01/hello.php
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Using Echo</title>
</head>
<body>
<?php
echo 'Hello, <strong>world</strong>!';
?>
</body>
</html>
13 changes: 13 additions & 0 deletions ch01/test.php
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Using Echo</title>
</head>
<body>
<?php
echo 'This sentence is
printed over two lines.';
?>
</body>
</html>
2 changes: 1 addition & 1 deletion ch02/form.html
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Simple HTML Form</title>
<style type="text/css" title="text/css" media="all">
<style type="text/css">
label {
font-weight: bold;
color: #300ACC;
Expand Down
4 changes: 2 additions & 2 deletions ch02/handle_form.php
Expand Up @@ -9,8 +9,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>
<pre>{$_POST['comments']}</pre></p>
echo "<p>Thank you, <strong>{$_POST['name']}</strong>, for the following comments:</p>
<pre>{$_POST['comments']}</pre>
<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
4 changes: 2 additions & 2 deletions ch02/script_02_02/handle_form.php
Expand Up @@ -18,8 +18,8 @@
*/

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

?>
Expand Down
4 changes: 2 additions & 2 deletions ch02/script_02_04/handle_form.php
Expand Up @@ -59,8 +59,8 @@
// If everything is OK, print the message:
if ($name && $email && $gender && $comments) {

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

echo $greeting;
Expand Down
8 changes: 4 additions & 4 deletions ch09/mysqli_connect.php
Expand Up @@ -5,10 +5,10 @@
// selects the database, and sets the encoding.

// Set the database access information as constants:
DEFINE('DB_USER', 'username');
DEFINE('DB_PASSWORD', 'password');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'sitename');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
define('DB_NAME', 'sitename');

// Make the connection:
$dbc = @mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die('Could not connect to MySQL: ' . mysqli_connect_error() );
Expand Down
12 changes: 9 additions & 3 deletions ch09/script_09_04/view_users.php
Expand Up @@ -16,8 +16,14 @@
if ($r) { // If it ran OK, display the records.

// Table header.
echo '<table align="center" cellspacing="3" cellpadding="3" width="75%">
<tr><td align="left"><strong>Name</strong></td><td align="left"><strong>Date Registered</strong></td></tr>
echo '<table width="60%">
<thead>
<tr>
<th align="left">Name</th>
<th align="left">Date Registered</th>
</tr>
</thead>
<tbody>
';

// Fetch and print all the records:
Expand All @@ -26,7 +32,7 @@
';
}

echo '</table>'; // Close the table.
echo '</tbody></table>'; // Close the table.

mysqli_free_result ($r); // Free up the resources.

Expand Down
12 changes: 9 additions & 3 deletions ch09/view_users.php
Expand Up @@ -22,8 +22,14 @@
echo "<p>There are currently $num registered users.</p>\n";

// Table header.
echo '<table align="center" cellspacing="3" cellpadding="3" width="75%">
<tr><td align="left"><strong>Name</strong></td><td align="left"><strong>Date Registered</strong></td></tr>
echo '<table width="60%">
<thead>
<tr>
<th align="left">Name</th>
<th align="left">Date Registered</th>
</tr>
</thead>
<tbody>
';

// Fetch and print all the records:
Expand All @@ -32,7 +38,7 @@
';
}

echo '</table>'; // Close the table.
echo '</tbody></table>'; // Close the table.

mysqli_free_result ($r); // Free up the resources.

Expand Down
4 changes: 2 additions & 2 deletions ch11/upload_image.php
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Upload an Image</title>
<style type="text/css" title="text/css" media="all">
<style>
.error {
font-weight: bold;
color: #C00;
Expand All @@ -20,7 +20,7 @@
if (isset($_FILES['upload'])) {

// Validate the type. Should be JPEG or PNG.
$allowed = ['image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png';
$allowed = ['image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png'];
if (in_array($_FILES['upload']['type'], $allowed)) {

// Move the file over.
Expand Down
2 changes: 1 addition & 1 deletion ch13/upload_rtf.php
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Upload a RTF Document</title>
<title>Upload an RTF Document</title>
</head>
<body>
<?php # Script 13.3 - upload_rtf.php
Expand Down
2 changes: 1 addition & 1 deletion ch14/matches.php
Expand Up @@ -5,7 +5,7 @@
<title>Testing PCRE</title>
</head>
<body>
<?php // Script 14.2 - matches.php
<?php # Script 14.2 - matches.php
// This script takes a submitted string and checks it against a submitted pattern.
// This version prints every match made.

Expand Down
2 changes: 1 addition & 1 deletion ch14/pcre.php
Expand Up @@ -5,7 +5,7 @@
<title>Testing PCRE</title>
</head>
<body>
<?php // Script 14.1 - pcre.php
<?php # Script 14.1 - pcre.php
// This script takes a submitted string and checks it against a submitted pattern.

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
Expand Down
2 changes: 1 addition & 1 deletion ch14/replace.php
Expand Up @@ -5,7 +5,7 @@
<title>Testing PCRE Replace</title>
</head>
<body>
<?php // Script 14.3 - replace.php
<?php # Script 14.3 - replace.php
// This script takes a submitted string and checks it against a submitted pattern.
// This version replaces one value with another.

Expand Down
8 changes: 4 additions & 4 deletions ch16/mysqli_oop_connect.php
Expand Up @@ -5,10 +5,10 @@
// The MySQL interactions use OOP!

// Set the database access information as constants:
DEFINE('DB_USER', 'username');
DEFINE('DB_PASSWORD', 'password');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'sitename');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
define('DB_NAME', 'sitename');

// Make the connection:
$mysqli = new MySQLi(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
Expand Down

0 comments on commit 5118f2b

Please sign in to comment.