100% found this document useful (1 vote)
95 views

Learning PHP MySQL JavaScript Early Release 6th Edition Robin Nixon - Download the ebook now for instant access to all chapters

The document promotes various eBooks on web development, including titles on PHP, MySQL, JavaScript, and HTML5, authored by Robin Nixon and others. It highlights the benefits of learning these technologies for creating dynamic, database-driven websites and offers links to download the books in different formats. Additionally, it provides information about the organization of the content and the audience targeted by these resources.

Uploaded by

leelaridepkg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
95 views

Learning PHP MySQL JavaScript Early Release 6th Edition Robin Nixon - Download the ebook now for instant access to all chapters

The document promotes various eBooks on web development, including titles on PHP, MySQL, JavaScript, and HTML5, authored by Robin Nixon and others. It highlights the benefits of learning these technologies for creating dynamic, database-driven websites and offers links to download the books in different formats. Additionally, it provides information about the organization of the content and the audience targeted by these resources.

Uploaded by

leelaridepkg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Explore the full ebook collection and download it now at textbookfull.

com

Learning PHP MySQL JavaScript Early Release 6th


Edition Robin Nixon

https://textbookfull.com/product/learning-php-mysql-
javascript-early-release-6th-edition-robin-nixon/

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

Learning PHP, MySQL & JavaScript, 6th Edition Robin Nixon

https://textbookfull.com/product/learning-php-mysql-javascript-6th-
edition-robin-nixon/

textbookfull.com

Learning PHP MySQL JavaScript With jQuery CSS HTML5 5th


Edition Robin Nixon

https://textbookfull.com/product/learning-php-mysql-javascript-with-
jquery-css-html5-5th-edition-robin-nixon/

textbookfull.com

Learn PHP 8: Using MySQL, JavaScript, CSS3, and HTML5


Second Edition Steve Prettyman

https://textbookfull.com/product/learn-php-8-using-mysql-javascript-
css3-and-html5-second-edition-steve-prettyman/

textbookfull.com

PHP and MySQL for Dynamic Web Sites Fifth Edition Ullman

https://textbookfull.com/product/php-and-mysql-for-dynamic-web-sites-
fifth-edition-ullman/

textbookfull.com
Learning Node Moving to the Server Side Early Release
Shelley Powers

https://textbookfull.com/product/learning-node-moving-to-the-server-
side-early-release-shelley-powers/

textbookfull.com

HTML5 20 Lessons to Successful Web Development 1st Edition


Robin Nixon

https://textbookfull.com/product/html5-20-lessons-to-successful-web-
development-1st-edition-robin-nixon/

textbookfull.com

PHP and MySQL Web Development 5th Edition Developer s


Library Luke Welling

https://textbookfull.com/product/php-and-mysql-web-development-5th-
edition-developer-s-library-luke-welling/

textbookfull.com

Beginning PHP and MySQL: From Novice to Professional 5th


Edition Frank M. Kromann

https://textbookfull.com/product/beginning-php-and-mysql-from-novice-
to-professional-5th-edition-frank-m-kromann/

textbookfull.com

Hands On Machine Learning with Scikit Learn and TensorFlow


Early Release 2nd Edition Aurélien Géron

https://textbookfull.com/product/hands-on-machine-learning-with-
scikit-learn-and-tensorflow-early-release-2nd-edition-aurelien-geron/

textbookfull.com
Learning PHP, MySQL &
JavaScript
SIXTH EDITION

With Early Release ebooks, you get books in their earliest form—the
author’s raw and unedited content as they write—so you can take
advantage of these technologies long before the official release of these
titles.

With PHP 8, MySQL 8, PDO, CSS, HTML5, jQuery


& React

Robin Nixon
Learning PHP, MySQL & JavaScript
by Robin Nixon
Copyright © 2021 Robin Nixon. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North,
Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales
promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.

Editor: Rachel Roumeliotis

Production Editor: Caitlin Ghegan

Copyeditor: TK

Proofreader: TK

Indexer: TK

Interior Designer: David Futato

Cover Designer: Karen Montgomery

Illustrator: Catherine Dullea

July 2009: First Edition


August 2012: Second Edition
June 2014: Third Edition
December 2014: Fourth Edition
May 2018: Fifth Edition
November 2021

Revision History for the Early Release


2021-02-04: First release

See http://oreilly.com/catalog/errata.csp?isbn=9781492093817 for release


details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Learning PHP, MySQL & JavaScript, the cover image, and related trade
dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure
that the information and instructions contained in this work are accurate, the
publisher and the author disclaim all responsibility for errors or omissions,
including without limitation responsibility for damages resulting from the
use of or reliance on this work. Use of the information and instructions
contained in this work is at your own risk. If any code samples or other
technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility
to ensure that your use thereof complies with such licenses and/or rights.
978-1-492-09381-7
[LSI]
Preface

The combination of PHP and MySQL is the most convenient approach to


dynamic, database-driven web design, holding its own in the face of
challenges from integrated frameworks—such as Ruby on Rails—that are
harder to learn. Due to its open source roots (unlike the competing
Microsoft .NET Framework), it is free to implement and is therefore an
extremely popular option for web development.
Any would-be developer on a Unix/Linux or even a Windows/Apache
platform will need to master these technologies. And, combined with the
partner technologies of JavaScript, React, CSS, and HTML5, you will be
able to create websites of the caliber of industry standards like Facebook,
Twitter, and Gmail.

Audience
This book is for people who wish to learn how to create effective and
dynamic websites. This may include webmasters or graphic designers who
are already creating static websites but wish to take their skills to the next
level, as well as high school and college students, recent graduates, and
self-taught individuals.
In fact, anyone ready to learn the fundamentals behind responsive web
design will obtain a thorough grounding in the core technologies of PHP,
MySQL, JavaScript, CSS, and HTML5, and you’ll learn the basics of the
React library and React Native Framework, too.
Assumptions This Book Makes
This book assumes that you have a basic understanding of HTML and can
at least put together a simple, static website, but does not assume that you
have any prior knowledge of PHP, MySQL, JavaScript, CSS, or HTML5—
although if you do, your progress through the book will be even quicker.

Organization of This Book


The chapters in this book are written in a specific order, first introducing all
of the core technologies it covers and then walking you through their
installation on a web development server so that you will be ready to work
through the examples.
In the first section, you will gain a grounding in the PHP programming
language, covering the basics of syntax, arrays, functions, and object-
oriented programming.
Then, with PHP under your belt, you will move on to an introduction to the
MySQL database system, where you will learn everything from how
MySQL databases are structured to how to generate complex queries.
After that, you will learn how you can combine PHP and MySQL to start
creating your own dynamic web pages by integrating forms and other
HTML features. You will then get down to the nitty-gritty practical aspects
of PHP and MySQL development by learning a variety of useful functions
and how to manage cookies and sessions, as well as how to maintain a high
level of security.
In the next few chapters, you will gain a thorough grounding in JavaScript,
from simple functions and event handling to accessing the Document
Object Model, in-browser validation, and error handling. You’ll also get a
comprehensive primer on using the popular React library for JavaScript.
With an understanding of all three of these core technologies, you will then
learn how to make behind-the-scenes Ajax calls and turn your websites into
highly dynamic environments.
Next, you’ll spend two chapters learning all about using CSS to style and
lay out your web pages, before discovering how the React libraries can
make your development job a great deal easier. You’ll then move on to the
final section on the interactive features built into HTML5, including
geolocation, audio, video, and the canvas. After this, you’ll put together
everything you’ve learned in a complete set of programs that together
constitute a fully functional social networking website.
Along the way, you’ll find plenty of advice on good programming practices
and tips that can help you find and solve hard-to-detect programming
errors. There are also plenty of links to websites containing further details
on the topics covered.

Supporting Books
Once you have learned to develop using PHP, MySQL, JavaScript, CSS,
and HTML5, you will be ready to take your skills to the next level using the
following O’Reilly reference books:

Dynamic HTML: The Definitive Reference by Danny Goodman


PHP in a Nutshell by Paul Hudson
MySQL in a Nutshell by Russell Dyer
JavaScript: The Definitive Guide by David Flanagan
CSS: The Definitive Guide by Eric A. Meyer and Estelle Weyl
HTML5: The Missing Manual by Matthew MacDonald

Conventions Used in This Book


The following typographical conventions are used in this book:
Plain text
Indicates menu titles, options, and buttons.
Italic
Indicates new terms, URLs, email addresses, filenames, file extensions,
pathnames, directories, and Unix utilities. Also used for database, table,
and column names.

Constant width

Indicates commands and command-line options, variables and other


code elements, HTML tags, and the contents of files.

Constant width bold


Shows program output and is used to highlight sections of code that are
discussed in the text.

Constant width italic


Shows text that should be replaced with user-supplied values.

NOTE
This element signifies a tip, suggestion, or general note.

WARNING
This element indicates a warning or caution.

Using Code Examples


Supplemental material (code examples, exercises, etc.) is available for
download at github.com/RobinNixon/lpmj6.
This book is here to help you get your job done. In general, if example code
is offered with this book, you may use it in your programs and
documentation. You do not need to contact us for permission unless you’re
reproducing a significant portion of the code. For example, writing a
program that uses several chunks of code from this book does not require
permission. Selling or distributing a set of examples from O’Reilly books
does require permission. Answering a question by citing this book and
quoting example code does not require permission. Incorporating a
significant amount of example code from this book into your product’s
documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually
includes the title, author, publisher, and ISBN. For example: “Learning
PHP, MySQL & JavaScript 6th Edition by Robin Nixon (O’Reilly).
Copyright 2021 Robin Nixon, [[[ISBN NUMBER GOES HERE]]].”
If you feel your use of code examples falls outside fair use or the
permission given above, feel free to contact us at permissions@oreilly.com.

O’Reilly Online Learning

NOTE
For more than 40 years, O’Reilly Media has provided technology and business training,
knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their knowledge and
expertise through books, articles, and our online learning platform.
O’Reilly’s online learning platform gives you on-demand access to live
training courses, in-depth learning paths, interactive coding environments,
and a vast collection of text and video from O’Reilly and 200+ other
publishers. For more information, visit http://oreilly.com.
How to Contact Us
Please address comments and questions concerning this book to the
publisher:

O’Reilly Media, Inc.

1005 Gravenstein Highway North

Sebastopol, CA 95472

(800) 998-9938 (in the United States or Canada)

(707) 829-0515 (international or local)

(707) 829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any
additional information. You can access this page at [[[ERRATA URL GOES
HERE]]].
To comment or ask technical questions about this book, send email to
bookquestions@oreilly.com.
For news and more information about our books and courses, see our
website at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments
I would like to thank Senior Content Acquisitions Editor, Amanda Quinn,
Content Development Editor, Melissa Potter, and everyone who worked so
hard on this book, including ???, ??? & ??? for their comprehensive
technical reviews, ??? for overseeing production, ??? for copy editing, ???
for proofreading, ??? for creating the index, Karen Montgomery for the
original sugar glider front cover design, ??? for the latest book cover, my
original editor, Andy Oram, for overseeing the first five editions, and
everyone else too numerous to name who submitted errata and offered
suggestions for this new edition.
Chapter 1. Introduction to
Dynamic Web Content

The World Wide Web is a constantly evolving network that has already
traveled far beyond its conception in the early 1990s, when it was created to
solve a specific problem. State-of-the-art experiments at CERN (the
European Laboratory for Particle Physics, now best known as the operator
of the Large Hadron Collider) were producing incredible amounts of data—
so much that the data was proving unwieldy to distribute to the participating
scientists, who were spread out across the world.
At this time, the internet was already in place, connecting several hundred
thousand computers, so Tim Berners-Lee (a CERN fellow) devised a
method of navigating between them using a hyperlinking framework, which
came to be known as Hypertext Transfer Protocol, or HTTP. He also created
a markup language called Hypertext Markup Language, or HTML. To bring
these together, he wrote the first web browser and web server.
Today we take these tools for granted, but back then, the concept was
revolutionary. The most connectivity so far experienced by at-home modem
users was dialing up and connecting to a bulletin board that was hosted by a
single computer, where you could communicate and swap data only with
other users of that service. Consequently, you needed to be a member of
many bulletin board systems in order to effectively communicate
electronically with your colleagues and friends.
But Berners-Lee changed all that in one fell swoop, and by the mid-1990s,
there were three major graphical web browsers competing for the attention
of 5 million users. It soon became obvious, though, that something was
missing. Yes, pages of text and graphics with hyperlinks to take you to other
pages was a brilliant concept, but the results didn’t reflect the instantaneous
potential of computers and the internet to meet the particular needs of each
user with dynamically changing content. Using the web was a very dry and
plain experience, even if we did now have scrolling text and animated
GIFs!
Shopping carts, search engines, and social networks have clearly altered
how we use the web. In this chapter, we’ll take a brief look at the various
components that make up the web, and the software that helps make using it
a rich and dynamic experience.

NOTE
It is necessary to start using some acronyms more or less right away. I have tried to
clearly explain them before proceeding, but don’t worry too much about what they stand
for or what these names mean, because the details will become clear as you read on.

HTTP and HTML: Berners-Lee’s Basics


HTTP is a communication standard governing the requests and responses
that are sent between the browser running on the end user’s computer and
the web server. The server’s job is to accept a request from the client and
attempt to reply to it in a meaningful way, usually by serving up a requested
web page—that’s why the term server is used. The natural counterpart to a
server is a client, so that term is applied both to the web browser and the
computer on which it’s running.
Between the client and the server there can be several other devices, such as
routers, proxies, gateways, and so on. They serve different roles in ensuring
that the requests and responses are correctly transferred between the client
and server. Typically, they use the internet to send this information. Some of
these in-between devices can also help speed up the internet by storing
pages or information locally in what is called a cache, and then serving this
content up to clients directly from the cache rather than fetching it all the
way from the source server.
A web server can usually handle multiple simultaneous connections, and
when not communicating with a client, it spends its time listening for an
incoming connection. When one arrives, the server sends back a response to
confirm its receipt.

The Request/Response Procedure


At its most basic level, the request/response process consists of a web
browser asking the web server to send it a web page and the server sending
back the page. The browser then takes care of displaying the page (see
Figure 1-1).
Figure 1-1. The basic client/server request/response sequence

The steps in the request and response sequence are as follows:


1. You enter http://server.com into your browser’s address bar.
2. Your browser looks up the Internet Protocol (IP) address for
server.com.
3. Your browser issues a request for the home page at server.com.
4. The request crosses the internet and arrives at the server.com web
server.
5. The web server, having received the request, looks for the web
page on its disk.
6. The web server retrieves the page and returns it to the browser.
7. Your browser displays the web page.
For an average web page, this process also takes place once for each object
within the page: a graphic, an embedded video or Flash file, and even a
CSS template.
In step 2, notice that the browser looks up the IP address of server.com.
Every machine attached to the internet has an IP address—your computer
included—but we generally access web servers by name, such as
google.com. As you probably know, the browser consults an additional
internet service called the Domain Name Service (DNS) to find the server’s
associated IP address and then uses it to communicate with the computer.
For dynamic web pages, the procedure is a little more involved, because it
may bring both PHP and MySQL into the mix. For instance, you may click
on a picture of a raincoat. Then PHP will put together a request using the
standard database language, SQL—many of whose commands you will
learn in this book—and send the request to the MySQL server. The MySQL
server will return information about the raincoat you selected, and the PHP
code will wrap it all up in some HTML, which the server will send to your
browser (see Figure 1-2).
Figure 1-2. A dynamic client/server request/response sequence

The steps are as follows:


1. You enter http://server.com into your browser’s address bar.
2. Your browser looks up the IP address for server.com.
3. Your browser issues a request to that address for the web server’s
home page.
4. The request crosses the internet and arrives at the server.com web
server.
5. The web server, having received the request, fetches the home page
from its hard disk.
6. With the home page now in memory, the web server notices that it
is a file incorporating PHP scripting and passes the page to the
PHP interpreter.
7. The PHP interpreter executes the PHP code.
8. Some of the PHP contains SQL statements, which the PHP
interpreter now passes to the MySQL database engine.
9. The MySQL database returns the results of the statements to the
PHP interpreter.
10. The PHP interpreter returns the results of the executed PHP code,
along with the results from the MySQL database, to the web server.
11. The web server returns the page to the requesting client, which
displays it.

Although it’s helpful to be aware of this process so that you know how the
three elements work together, in practice you don’t really need to concern
yourself with these details, because they all happen automatically.
The HTML pages returned to the browser in each example may well
contain JavaScript, which will be interpreted locally by the client, and
which could initiate another request—the same way embedded objects such
as images would.

The Benefits of PHP, MySQL, JavaScript,


CSS, and HTML5
At the start of this chapter, I introduced the world of Web 1.0, but it wasn’t
long before the rush was on to create Web 1.1, with the development of
such browser enhancements as Java, JavaScript, JScript (Microsoft’s slight
variant of JavaScript), and ActiveX. On the server side, progress was being
made on the Common Gateway Interface (CGI) using scripting languages
such as Perl (an alternative to the PHP language) and server-side scripting
—inserting the contents of one file (or the output of running a local
program) into another one dynamically.
Once the dust had settled, three main technologies stood head and shoulders
above the others. Although Perl was still a popular scripting language with
a strong following, PHP’s simplicity and built-in links to the MySQL
database program had earned it more than double the number of users. And
JavaScript, which had become an essential part of the equation for
dynamically manipulating Cascading Style Sheets (CSS) and HTML, now
took on the even more muscular task of handling the client side of the
asynchronous communication (exchanging data between a client and server
after a web page has loaded). Using asynchronous communication, web
pages perform data handling and send requests to web servers in the
background—without the web user being aware that this is going on.
No doubt the symbiotic nature of PHP and MySQL helped propel them
both forward, but what attracted developers to them in the first place? The
simple answer has to be the ease with which you can use them to quickly
create dynamic elements on websites. MySQL is a fast and powerful yet
easy-to-use database system that offers just about anything a website would
need in order to find and serve up data to browsers. When PHP allies with
MySQL to store and retrieve this data, you have the fundamental parts
required for the development of social networking sites and the beginnings
of Web 2.0.
And when you bring JavaScript and CSS into the mix too, you have a recipe
for building highly dynamic and interactive websites—especially as there is
now a wide range of sophisticated frameworks of JavaScript functions you
can call on to really speed up web development, such as the well-known
jQuery, which until very recently was one of the most common way
programmers access asynchronous communication features, and the more
recent React JavaScript library which has been growing quickly in
popularity, and is now one of the most widely downloaded and
implemented frameworks, so much so that since 2020 the Indeed job site
lists more than twice as many positions for React developers than for
jQuery.

MariaDB: The MySQL Clone


After Oracle purchased Sun Microsystems (the owners of MySQL), the
community became wary that MySQL might not remain fully open source,
so MariaDB was forked from it to keep it free under the GNU GPL.
Development of MariaDB is led by some of the original developers of
MySQL and it retains exceedingly close compatibility with MySQL.
Therefore, you may well encounter MariaDB on some servers in place of
MySQL—but not to worry, everything in this book works equally well on
both MySQL and MariaDB, which is based on the same code base as
MySQL Server 5.5. To all intents and purposes you can swap one with the
other and notice no difference.
Anyway, as it turns out, many of the initial fears appear to have been
allayed as MySQL remains open source, with Oracle simply charging for
support and for editions that provide additional features such as geo-
replication and automatic scaling. However, unlike MariaDB, MySQL is no
longer community driven, so knowing that MariaDB will always be there if
ever needed will keep many developers sleeping at night, and probably
ensures that MySQL itself will remain open source.
Using PHP
With PHP, it’s a simple matter to embed dynamic activity in web pages.
When you give pages the .php extension, they have instant access to the
scripting language. From a developer’s point of view, all you have to do is
write code such as the following:

<?php
echo " Today is " . date("l") . ". ";
?>

Here's the latest news.

The opening <?php tells the web server to allow the PHP program to
interpret all the following code up to the ?> tag. Outside of this construct,
everything is sent to the client as direct HTML. So, the text Here's the
latest news. is simply output to the browser; within the PHP tags, the
built-in date function displays the current day of the week according to
the server’s system time.
The final output of the two parts looks like this:

Today is Wednesday. Here's the latest news.

PHP is a flexible language, and some people prefer to place the PHP
construct directly next to PHP code, like this:

Today is <?php echo date("l"); ?>. Here's the latest news.

There are even more ways of formatting and outputting information, which
I’ll explain in the chapters on PHP. The point is that with PHP, web
developers have a scripting language that, although not as fast as compiling
your code in C or a similar language, is incredibly speedy and also
integrates seamlessly with HTML markup.
NOTE
If you intend to enter the PHP examples in this book into a program editor to work
along with me, you must remember to add <?php in front and ?> after them to ensure
that the PHP interpreter processes them. To facilitate this, you may wish to prepare a file
called example.php with those tags in place.

Using PHP, you have unlimited control over your web server. Whether you
need to modify HTML on the fly, process a credit card, add user details to a
database, or fetch information from a third-party website, you can do it all
from within the same PHP files in which the HTML itself resides.

Using MySQL
Of course, there’s not a lot of point to being able to change HTML output
dynamically unless you also have a means to track the information users
provide to your website as they use it. In the early days of the web, many
sites used “flat” text files to store data such as usernames and passwords.
But this approach could cause problems if the file wasn’t correctly locked
against corruption from multiple simultaneous accesses. Also, a flat file can
get only so big before it becomes unwieldy to manage—not to mention the
difficulty of trying to merge files and perform complex searches in any kind
of reasonable time.
That’s where relational databases with structured querying become
essential. And MySQL, being free to use and installed on vast numbers of
internet web servers, rises superbly to the occasion. It is a robust and
exceptionally fast database management system that uses English-like
commands.
The highest level of MySQL structure is a database, within which you can
have one or more tables that contain your data. For example, let’s suppose
you are working on a table called users, within which you have created
columns for surname, firstname, and email, and you now wish to
add another user. One command that you might use to do this is as follows:
INSERT INTO users VALUES('Smith', 'John', 'jsmith@mysite.com');

You will previously have issued other commands to create the database and
table and to set up all the correct fields, but the SQL INSERT command
here shows how simple it can be to add new data to a database. SQL is a
language designed in the early 1970s that is reminiscent of one of the oldest
programming languages, COBOL. It is well suited, however, to database
queries, which is why it is still in use after all this time.
It’s equally easy to look up data. Let’s assume that you have an email
address for a user and need to look up that person’s name. To do this, you
could issue a MySQL query such as the following:

SELECT surname,firstname FROM users WHERE


email='jsmith@mysite.com';

MySQL will then return Smith, John and any other pairs of names that
may be associated with that email address in the database.
As you’d expect, there’s quite a bit more that you can do with MySQL than
just simple INSERT and SELECT commands. For example, you can
combine related data sets to bring related pieces of information together,
ask for results in a variety of orders, make partial matches when you know
only part of the string that you are searching for, return only the nth result,
and a lot more.
Using PHP, you can make all these calls directly to MySQL without having
to directly access the MySQL command-line interface yourself. This means
you can save the results in arrays for processing and perform multiple
lookups, each dependent on the results returned from earlier ones, to drill
down to the item of data you need.
For even more power, as you’ll see later, there are additional functions built
right into MySQL that you can call up to efficiently run common operations
within MySQL, rather than creating them out of multiple PHP calls to
MySQL.
Using JavaScript
The oldest of the three core technologies discussed in this book, JavaScript,
was created to enable scripting access to all the elements of an HTML
document. In other words, it provides a means for dynamic user interaction
such as checking email address validity in input forms and displaying
prompts such as “Did you really mean that?” (although it cannot be relied
upon for security, which should always be performed on the web server).
Combined with CSS (see the following section), JavaScript is the power
behind dynamic web pages that change in front of your eyes rather than
when a new page is returned by the server.
However, JavaScript can also be tricky to use, due to some major
differences in the ways different browser designers have chosen to
implement it. This mainly came about when some manufacturers tried to
put additional functionality into their browsers at the expense of
compatibility with their rivals.
Thankfully, the developers have mostly now come to their senses and have
realized the need for full compatibility with one another, so it is less
necessary these days to have to optimize your code for different browsers.
However, there remain millions of users using legacy browsers, and this
will likely be the case for a good many years to come. Luckily, there are
solutions for the incompatibility problems, and later in this book we’ll look
at libraries and techniques that enable you to safely ignore these differences.
For now, let’s take a look at how to use basic JavaScript, accepted by all
browsers:

<script type="text/javascript">
document.write("Today is " + Date() );
</script>

This code snippet tells the web browser to interpret everything within the
<script> tags as JavaScript, which the browser does by writing the text
Today is to the current document, along with the date, using the
JavaScript function Date. The result will look something like this:

Today is Wed Jan 01 2025 01:23:45

NOTE
Unless you need to specify an exact version of JavaScript, you can normally omit the
type="text/javascript" and just use <script> to start the interpretation of
the JavaScript.

As previously mentioned, JavaScript was originally developed to offer


dynamic control over the various elements within an HTML document, and
that is still its main use. But more and more, JavaScript is being used for
asynchronous communication, the process of accessing the web server in
the background.
Asynchronous communication is what allows web pages to begin to
resemble standalone programs, because they don’t have to be reloaded in
their entirety to display new content. Instead, an asynchronous call can pull
in and update a single element on a web page, such as changing your
photograph on a social networking site or replacing a button that you click
with the answer to a question. This subject is fully covered in Chapter 18.
Then, in Chapter 24, we take a good look at the jQuery framework, which
you can use to save reinventing the wheel when you need fast, cross-
browser code to manipulate your web pages. Of course, there are other
frameworks available too, so we also take a look at React, one of the most
popular choices of today, in Chapter 24 . Both are extremely reliable, and
are major tools in the utility kits of many seasoned web developers.

Using CSS
CSS is the crucial companion to HTML, ensuring that the HTML text and
embedded images are laid out consistently and in a manner appropriate for
the user’s screen. With the emergence of the CSS3 standard in recent years,
CSS now offers a level of dynamic interactivity previously supported only
by JavaScript. For example, not only can you style any HTML element to
change its dimensions, colors, borders, spacing, and so on, but now you can
also add animated transitions and transformations to your web pages, using
only a few lines of CSS.
Using CSS can be as simple as inserting a few rules between <style> and
</style> tags in the head of a web page, like this:

<style>
p {
text-align:justify;
font-family:Helvetica;
}
</style>

These rules change the default text alignment of the <p> tag so that
paragraphs contained in it are fully justified and use the Helvetica font.
As you’ll learn in Chapter 19 , there are many different ways you can lay
out CSS rules, and you can also include them directly within tags or save a
set of rules to an external file to be loaded in separately. This flexibility not
only lets you style your HTML precisely, but can also (for example)
provide built-in hover functionality to animate objects as the mouse passes
over them. You will also learn how to access all of an element’s CSS
properties from JavaScript as well as HTML.

And Then There’s HTML5


As useful as all these additions to the web standards became, they were not
enough for ever more ambitious developers. For example, there was still no
simple way to manipulate graphics in a web browser without resorting to
plug-ins such as Flash. And the same went for inserting audio and video
into web pages. Plus, several annoying inconsistencies had crept into
HTML during its evolution.
So, to clear all this up and take the internet beyond Web 2.0 and into its next
iteration, a new standard for HTML was created to address all these
shortcomings: HTML5. Its development began as long ago as 2004, when
the first draft was drawn up by the Mozilla Foundation and Opera Software
(developers of two popular web browsers), but it wasn’t until the start of
2013 that the final draft was submitted to the World Wide Web Consortium
(W3C), the international governing body for web standards.
It has taken a few years for HTML5 to develop, but now we are at a very
solid and stable version 5.1 (since 2016). It’s a never-ending cycle of
development, though, and more functionality is sure to be built into it over
time, with version 5.2 (planned to make the plugin system obsolete)
released as a W3C recommendation in 2017, and HTML 5.3 (with
proposed features such as auto-capitalisation) still in planning as of 2020,
and so on. Some of the best features in HTML5 for handling and displaying
media include the <audio>, <video>, and <canvas> elements, which
add sound, video, and advanced graphics. Everything you need to know
about these and all other aspects of HTML5 is covered in detail starting in
Chapter 25 .

NOTE
One of the little things I like about the HTML5 specification is that XHTML syntax is
no longer required for self-closing elements. In the past, you could display a line break
using the <br> element. Then, to ensure future compatibility with XHTML (the
planned replacement for HTML that never happened), this was changed to <br />, in
which a closing / character was added (since all elements were expected to include a
closing tag featuring this character). But now things have gone full circle, and you can
use either version of these types of elements. So, for the sake of brevity and fewer
keystrokes, in this book I have reverted to the former style of <br>, <hr>, and so on.

The Apache Web Server


In addition to PHP, MySQL, JavaScript, CSS, and HTML5, there’s a sixth
hero in the dynamic web: the web server. In the case of this book, that
means the Apache web server. We’ve discussed a little of what a web server
does during the HTTP server/client exchange, but it does much more
behind the scenes.
For example, Apache doesn’t serve up just HTML files—it handles a wide
range of files, from images and Flash files to MP3 audio files, RSS (Really
Simple Syndication) feeds, and so on. And these objects don’t have to be
static files such as GIF images. They can all be generated by programs such
as PHP scripts. That’s right: PHP can even create images and other files for
you, either on the fly or in advance to serve up later.
To do this, you normally have modules either precompiled into Apache or
PHP or called up at runtime. One such module is the GD (Graphics Draw)
library, which PHP uses to create and handle graphics.
Apache also supports a huge range of modules of its own. In addition to the
PHP module, the most important for your purposes as a web programmer
are the modules that handle security. Other examples are the Rewrite
module, which enables the web server to handle a range of URL types and
rewrite them to its own internal requirements, and the Proxy module, which
you can use to serve up often-requested pages from a cache to ease the load
on the server.
Later in the book, you’ll see how to use some of these modules to enhance
the features provided by the three core technologies.

Handling Mobile Devices


We are now firmly in a world of interconnected mobile computing devices,
and the concept of developing websites solely for desktop computers has
become rather dated. Instead, developers now aim to develop responsive
websites and web apps that tailor themselves to the environment in which
they find themselves running.
So, new in this edition, I show how you can easily create these types of
products using just the technologies detailed in this book, along with the
powerful jQuery Mobile library of responsive JavaScript functions. With it,
Discovering Diverse Content Through
Random Scribd Documents
can interpret for you) that I have been sent for by the prime minister
at a minute’s notice, à la De Grandeville.”
“’Tis too late,” replied Frere; and at the same instant the Doctor
seized Bracy by the button, and in a stern and impressive manner
asked some apparently searching question in Persian. Few men had
enjoyed the delight of seeing Tom Bracy in the unenviable frame of
mind expressed by the nautical term “taken aback,” but of that
favoured few were the bystanders on the present occasion. Never
was an unhappy individual more thoroughly and completely at a
loss; and it must be confessed the situation was an embarrassing
one. To be addressed by an elderly stranger in an unintelligible
language, in which you are expected to reply, while at the same time
you are painfully conscious that your incapacity to do so, or even
(not understanding the question) to give an appropriate answer in
your native tongue, will lead to a discovery you are most anxious to
avert, is an undeniably awkward position in which to be placed. That
Bracy found it so was most evident, for he fidgeted, stammered,
glanced appealingly towards Frere for aid, and at last was obliged,
between annoyance and an intense appreciation of the absurdity of
his situation, to get up a fictitious cough, which, irritating the
membrane of the nose, produced a most violent genuine sneeze.
From the effects of this convulsion of nature he was relieved by a
hearty slap on the back, while at the same moment the tones of a
familiar voice exclaimed in his ear—
“Sold, by all that’s glorious! Bracy, my boy, how do you find
yourself?” and on looking up he recognised in the laughing face of
the Addiscombe doctor, now divested of its spectacles, the well-
known features of Charley Leicester.
CHAPTER XII.—LEWIS FORFEITS
THE RESPECT OF ALL POOR-LAW
GUARDIANS.

E
qually surprised and mystified at the complete manner in
which the tables had been turned upon him, Bracy stood
listening with a disgusted expression of countenance to the
peals of laughter which his discomfiture elicited from his
companions.
“Yes, laugh away,” growled the victimised practical joker; “it’s all
very funny, I dare say, but one thing I’ll swear in any court of justice,
which is, that you have been talking real Persian, at least if what
Frere jabbers is real Persian.”
“Of course I have,” returned Leicester, still in convulsions. “When
Frere and I planned this dodge we knew what a wide-awake
gentleman we had to deal with, and took our measures accordingly.
I learned four Persian sentences by heart from his dictation, and
pretty good use I have made of them too, I think.”
“It was not a bad idea, really,” observed Bracy, who, having got
over his annoyance at the first sense of defeat, instantly recovered
his good-humour. “How well you are got up! I did not recognise you
one bit till you pulled off the barnacles.”
“Yes, I got little Stevens, who does the light comic business at one
of the minors, to provide the apparel and come and dress me. I
hope you admire my complexion; he laid on the red and yellow most
unsparingly.”
“He has done it vastly well,” returned Bracy. “I shall cultivate that
small man; he may be extremely useful to me on an occasion.”
“Now we ought to be going upstairs,” interrupted Frere; “these
waiter fellows are beginning to stare at us suspiciously too. I say,
Bracy, cut it short, man; we have had all the fun now, and I’m
getting tired of the thing.”
“Ya, Meinheer,” rejoined Bracy aloud, adding in a lower tone, “The
slaveys will swallow that or anything else for Persian. They are all
more or less drunk, by the fishy expression of their optics.”
Laura Peyton was astonished somewhat later in the evening by
the Addiscombe professor leaning over the back of the sofa on which
she was seated and asking whether she had enjoyed her last valse
at Almack’s the evening before last.
“Surely you can feel no particular interest about such a frivolous
and unintellectual matter, sir,” was the reply.
“I was about to follow up the inquiry by asking whether your
partner made himself agreeable.”
“To which I shall reply, after the Irish fashion, by asking how it can
possibly concern you to know, sir?”
“Merely because I have the honour of the gentleman’s
acquaintance.”
“That, in fact, you are one of those uncommon characters who
know themselves,” returned Laura with an arch smile. “Is not that
what you wish to impress upon me, Mr. Leicester?”
Charley laughed, then continued in a lower tone, “I saw you knew
me. Did your own acuteness lead to the discovery, or are there
traitors among us?”
“Your friend Mr. Arundel’s expressive features let me into the
secret of his acquaintance with the English language before we went
down to supper; but I entered into a contract, not to betray the plot
if he would tell me all I might wish to know about it, so the moment
he came up I made him inform me who you were. What a
gentlemanly, agreeable person he is!”
As she said this a slight shade passed across Leicester’s good-
natured countenance, and he replied, more quickly than was his
wont—
“I had fancied Miss Peyton superior to the common feminine
weakness of being caught by the last handsome face.”
“What a thoroughly man-like speech!” returned the young lady.
“Did I say anything about his appearance, sir? Do you suppose we
poor women are so utterly silly that we can appreciate nothing but a
handsome face? Your professor’s disguise has imbued you with the
Turkish belief that women have no souls.”
“No one fortunate enough to be acquainted with Miss Peyton
would continue long in such a heresy,” replied Leicester, with the air
of a man who thinks he is saying a good thing.
“Yes, I knew you would make some such reply,” returned Laura.
“You first show your real opinion of women by libelling the whole
sex, and then try to get out of the scrape by insulting my
understanding with a personal compliment. Wait,” she continued,
seeing he was about to defend himself, “you must not talk to me any
more now, or you will excite Lady Lombard’s suspicions and betray
the whole conspiracy. Go away, and send my new friend Mr. Arundel
Hassan Bey here; Lady Lombard committed him to my charge, and I
want to cultivate him.”
Leicester tried to assume a languishing look, which he was in the
habit of practising upon young ladies with great success, but
becoming suddenly conscious of the wig and spectacles, and
gathering from Laura’s silvery laugh that such adjuncts to an
interesting expression of countenance were incongruous, not to say
absurd, he joined in her merriment, then added, “You are in a very
wicked mood to-night, Miss Peyton; but I suppose I must e’en do as
you bid me, and reserve my revenge till some more fitting
opportunity;” then, mixing with the crowd, he sought out Lewis and
delivered the young lady’s message to him, adding in his usual
drawling tone, “You have made a what-do-ye-call-it—an impression
in that quarter. Women always run after the last new face.”
“You are right,” returned Lewis, with a degree of energy which
startled his listless companion; “and those men are wisest who know
them for the toys they are, and avoid them.”
Leicester gazed after his retreating figure in astonishment, then
murmured to himself, “What’s in the wind now, I wonder; is the
good youth trying to keep up the Asiatic character, or suddenly
turned woman-hater? Confound that little Peyton girl, how sharp she
was to-night!”
“How very well Mr. Leicester is disguised!” observed Laura Peyton
to Lewis, after they had conversed in German for some minutes on
general topics.
“Yes,” replied Lewis; “though I can’t say his appearance is
improved by the alteration.”
“A fact of which he is fully aware,” returned Laura, smiling.
A pause ensued, which was terminated by Laura’s asking abruptly,
“Do gentlemen like Mr. Leicester?”
“Really I have not sufficient knowledge of facts to inform you, but
I should say he is a very popular man.”
“Popular man! I hate that phrase,” returned his companion
pettishly. “It is almost as bad as describing any one as a man about
town, which always gives me the idea of a creature that wears a
pea-jacket, lives at a club, boards on cigars, talks slang, carries a
betting-book, and never has its hair cut. Can’t you tell me what you
think of Mr. Leicester yourself?”
“Well, I think him gentlemanly, good-natured, agreeable up to a
certain point, cleverish—-”
^ “Yes, that will do; I quite understand. I don’t think you do him
justice—he has a kind heart, and more good sense than you are
disposed to give him credit for. You should not form such hasty
judgments of people; a want of charity I perceive is one of your
faults. And now I must wish you good-night; I hear my kind old
chaperone anxiously bleating after me in the distance.”
So saying she arose and hastened to put herself under the
protection of “a fine old English gentlewoman,” who, with a hooked
nose, red gown, and green scarf, looked like some new and fearful
variety of the genus Parroquet. At the same time, Bracy summoned
Lewis to join the Prince, who was about to depart, which, after Lady
Lombard had in an enthusiasm of gratitude uttered a whole
sentence in the largest capitals, he was allowed to do.
Leicester accompanied them, tearing himself away from Professor
Malchapeau, who had singled him out as a brother savan, and
commenced raconte-ing to him his affecting history, thereby leaving
that shaggy little child of misfortune to lament to his sympathising
hostess the melancholy fact that “Zie Professor Addiscombe had cut
his little tale off short, and transported himselfs avay in von great
despatch.”
’Twere long to tell the jokes that were made, the new and
additional matter brought to light, as each of the quartette,
assembled round a second edition of supper in Bracy’s rooms,
detailed in turn his own personal experiences of the evening’s
comicalities—the cigars that were smoked, or the amount of sherry
cobbler that was imbibed: suffice it to say, that a certain lyrical
declaration that they would not “go home till morning,” to which,
during their symposium, they had committed themselves, was
verified when, on issuing out into the street, the cold grey light of
early dawn threw its pale hue over their tired faces and struggled
with sickly-looking gas lamps for the honour of illuminating the
thoroughfares of the sleeping city.
Leicester’s cab, with his night-horse—a useful animal, which,
without a leg to stand upon, possessed the speed of the wind, and
having every defect horseflesh is heir to, enjoyed a constitution
which throve on exposure and want of sleep, as other organisations
usually do on the exact opposites—was in waiting. Into this vehicle
Charley (who bore some token of sherry cobbler in the unsteadiness
of his gait), having made two bad shots at the step, rushed
headlong and drove off at an insane pace, and in a succession of
zigzags.
Frere and Lewis watched the cab till, having slightly assaulted an
unoffending lamp-post, it flew round a corner and disappeared;
then, having exchanged a significant glance suggestive of
sympathetic anticipations of a sombre character in regard to the
safety of their friend, they started at a brisk pace, which soon
brought them to Frere’s respectable dwelling. While the proprietor
was searching in every pocket but the right one for that terror of all
feeble-minded elders, that pet abomination of all fathers of families,
that latest invention of the enemy of mankind—a latch-key—they
were accosted by a lad of about fifteen, whose ragged clothes,
bronzed features, and Murillo-like appearance accorded well with his
supplication, “Per pietà Signor, denaro per un pover’ Italiano.”
Frere looked at him attentively, then exclaimed, “I tell you what,
boy, it won’t do; you’re no more an Italian than I am. You should not
try to impose upon people.”
The boy hung down his head, and then replied doggedly, “It’s your
own fault; you’ll let an English boy starve in the streets before you’ll
give him a bit of bread, but you are charitable enough to them
foreign blackguards.”
“That’s not true,” replied Frere. “However, liar or not, you must be
fed, I suppose; so if you choose to take a soup-ticket, here’s one for
you.”
“No,” returned the boy proudly, “you have called me liar, and I
won’t accept your miserable bounty. I’d sooner starve first.”
“As you please,” returned Frere, coolly pocketing the rejected
ticket. “Now have the goodness to take yourself off. Come, Lewis.”
“I’ll join you immediately,” replied Lewis.
“Mind you shut the door after you, then,” continued Frere, “or we
shall have that nice lad walking off with the silver spoons.” So
saying, he entered the house.
Lewis waited till his retreating footsteps were no longer audible,
then fixing his piercing glance upon the boy, he said in an impressive
voice, “Answer me truly, and I will give you assistance. Where did
you learn to speak Italian with so good an accent?”
“In Naples, sir!”
“How did you get there?”
“I served on board a man-of-war.”
“And how have you fallen into this state of beggary?”
The boy hesitated for a moment, but something led him
instinctively to feel that his confidence would not be abused, and he
answered: “When we got back to England and the crew were paid
off I received £15. I got into bad company; they tempted me to
everything that was wrong. My money was soon gone; I had no
friends in London, and I wouldn’t have applied to them after going
on so bad if I’d had any. I sold my clothes to buy bread; and when I
had nothing left I begged, and lately I’ve passed myself off as an
Italian boy, because I found people more willing to give to me.”
“And do you like your present life?”
“No, I have to bear cold and hunger; and when people speak to
me as he did just now it makes me feel wicked. Some day it will
drive me mad, and I shall go and murder somebody.”
“What do you wish to do, then?”
“If I could buy some decent clothes, I’d walk down to Portsmouth
and try and get afloat again.”
“And what would it cost to provide them?”
“I could rig myself out for a pound.”
Lewis paused for a moment, then added quickly: “Boy, I am poor
and proud, as you are, therefore I can feel for you. Had I been
exposed to temptation, friendless and untaught, I might have fallen
as you have done. You have learnt a bitter lesson and may profit by
it; it is in my power to afford you a chance of doing so.”
He drew a card from his pocket and wrote upon it a few words in
pencil, then handing it to the boy, continued: “There is the direction
to a friend of mine, the captain of a ship about to sail in a few days;
show him my card, and tell him what you have told me. There is a
sovereign to provide your dress, and five shillings to save you from
begging or stealing till you get to Portsmouth; and when next you
are tempted to sin remember its bitter fruits.”
As he spoke he gave him the money. The boy received it
mechanically, fixed his bright eyes for a moment on the face of his
benefactor, and then, utterly overcome by such unexpected
kindness, burst into a flood of tears. As Lewis turned to depart the
first rays of the rising sun fell upon the tall, graceful figure of the
young man and the tattered garments and emaciated form of the
boy.
Far different was the scene when Lewis Arundel and the creature
he was thus rescuing from infamy met again upon the RAILROAD OF
LIFE!
CHAPTER XIII.—IS CHIEFLY
HORTICULTURAL, SHOWING THE
EFFECTS PRODUCED BY TRAINING
UPON A SWEET AND DELICATE
ROSE.

R
ose Arundel sat at the open window of her little bedroom and
gazed out into the night. The scent of many flowers hung
upon the loaded air, and the calm stars looked down from
Heaven, contrasting their impassive grandeur with the unrest of this
weary world. The evening had been lovely; not a breath of wind was
stirring; the long shadows that slept upon the green sward, and
afforded a dark background on which the brilliant glow-worms shone
like diamonds on a funeral pall, were motionless; the silence,
unbroken save when some heavy beetle or other strange insect of
the night winged its drowsy way across the casement, was almost
oppressive in its depth of stillness; it was a time and place for grave
and earnest thought, a scene in which the full heart is conscious of
its own sorrow. And Rose, although she had too much good sense
and right principle to allow herself to feel miserable, was far from
happy. The key to the inner life of every true-hearted woman must
be sought in the affections. The only two people whom Rose had
loved, as she was capable of loving, were her father and brother; for
Mrs. Arundel, though all her impulses were kind and amiable, did not
possess sufficient depth of character to inspire any very strong
attachment. Between Captain Arundel and his daughter had existed
one of those rare affections which appear so nearly to satisfy the
cravings of our spiritual nature, that lest this world should become
too dear to us they are blessings we are seldom permitted long to
enjoy. Rose and her father were by nature much alike in disposition,
and in forming her character, and educating and developing her
mind, he had for some years found his chief interest, while in her
affection lay his only solace for the blighted hopes and ruined
prospects of a lifetime.
Originally highly connected, Captain Arundel had incurred the
displeasure of his family by forming in the heat of youthful passion,
and under peculiar circumstances, a marriage with the daughter of
an English resident at Marseilles by a foreign mother. Too proud to
seek to conciliate his relations, Mr. Arundel became a voluntary exile,
entered into the Austrian army, where he speedily rose to the rank
of captain and served with much distinction, till failing health
induced him to resign his commission and return to England for the
sake of educating his children. His heart was set on one object—
namely, to bestow upon his son the education of an English
gentleman, and for this purpose he had availed himself of a very
unusual talent for painting as a means by which he might increase
his slender income sufficiently to meet the expenses of sending
Lewis to Westminster and afterwards to a German university. The
constant application thus rendered inevitable fostered the seeds of
that most insidious of all ailments, a heart-disease, and while still
forming plans for the welfare of his family, an unwonted agitation
induced a paroxysm of his complaint, and ere Rose could realise the
misfortune that threatened her she was fatherless.
Although stunned at first by the unexpected shock, hers was not a
mind to give way at such a moment, and to those who judge by the
outward expression only Mrs. Arundel’s grief appeared much more
intense than that of her daughter. But Rose’s sorrow was not a mere
transitory feeling, which a few weeks more or less might serve to
dissipate; it had become part of her very nature, a thing too sacred
to be lightly brought to view, but enshrined in the sanctuary of her
pure heart it remained a cherished yet solemn recollection, which
would shed its hallowing influence over the future of her young life.
And now, as she sat with her calm, earnest eyes upturned to the
tranquil heaven above her, her thoughts wandered back to him she
had so dearly loved, and she pondered the solemn questions which
have ere now presented themselves to many a mourning spirit, and
longed to penetrate the secrets of the grave and learn things which
death alone can teach us. Then she recalled conversations she had
held with him that was gone on these very subjects, and
remembered how he had said that the things which God had not
seen fit to reveal, could neither be needful nor expedient for us to
know; that such speculations were In themselves dangerous,
inasmuch as they tended to lead us to form theories which, having
no warrant in Scripture, might be at variance with truth; and that it
was better to wait patiently in humble faith—that a time would come
when we should no longer see through a glass darkly, and the
hidden things of God should be made known unto us. Then her
thoughts, still pursuing the same train, led her to reflect how all her
father’s aspirations, crushed and disappointed in the wreck of his
own fortunes, had centred in his son, and the bitter tears which no
personal privations or misfortunes could have forced from her,
flowed down her cheeks as she reflected how these bright
anticipations seemed doomed never to be realised.
Unselfish by nature, and trained to habits of thoughtfulness by
witnessing her father’s life of daily self-sacrifice, Rose had never
been accustomed to indulge on her own account in those day-
dreams so common to the sanguine mind of youth. But the germs of
that pride and ambition which were Lewis’s besetting sins existed in
a minor degree in Rose’s disposition also, and found vent in a
visionary career of greatness she had marked out for her brother,
and for which his unusual mental powers and striking appearance
seemed eminently to qualify him. In nourishing these visions her
father had unconsciously assisted, when in moments of confidence
he had imparted to her his hopes that Lewis would distinguish
himself in whatever career of life he might select, and by his success
restore them all to that position in society which by his own
imprudence he had forfeited. What a bitter contrast did the reality
now present! Rose had received that morning a letter from her
brother detailing his interview with General Grant and its results; and
though, from a wish to spare her feelings, he had been more
guarded in his expressions than on the occasion of his conversation
with Frere the preceding day, yet he did not attempt to disguise from
her his repugnance to the arrangement, or the degradation to which
his haughty spirit led him to consider he was submitting.
“Poor Lewis!” murmured Rose, “I know so well what misery it will
be to him; the slights, the hourly petty annoyances which his proud,
sensitive nature will feel so keenly; and then, to waste his high
talents, his energy of character and strength of will on the drudgery
of teaching, when they were certain to have led him to distinction if
he had only had a fair field for their exercise—it would have broken
dearest papa’s heart, when he had hoped so differently for him. But
if he had lived this never would have been so. He often told me he
had influential friends, and though he never would apply to them on
his own account, he declared he would do so when Lewis should
become old enough to enter into life. I wonder who they were. He
never liked to talk on those subjects, and I was afraid of paining him
by inquiring. I am glad there is a Miss Grant: I hope she may prove
a nice girl and will like Lewis; but of course she will—every one must
do that. Oh! how I hope they will treat him kindly and generously—it
will all depend upon that. Poor fellow! with his impulsive disposition
and quick sense of wrong—his fiery temper too, how will he get on?
And it is for our sakes he does all this, sacrificing his freedom and
his hopes of winning himself a name. How good and noble it is of
him!”
She paused, and leaning her brow upon her little white hand, sat
buried in deep thought. At length she spoke again.
“If I could do anything to earn money and help I should be so
much happier. Poor papa got a good deal lately for his pictures; but
they were so clever. Lewis can paint beautifully, but my drawings are
so tame. I wonder whether people would buy poetry. I wish I knew
whether my verses are good enough to induce any one to purchase
them. Dearest papa praised those lines of mine which he
accidentally found one day. Of course he was a good judge, only
perhaps he liked them because they were mine.” And the tears rolled
silently down her pale cheeks as memory brought before her the
glance of bright and surprised approval, the warm yet judicious
praise, the tender criticism—words, looks, and tones of love now lost
to her for ever, which the accidental discovery of her verses had
drawn forth. With an aching heart she closed the casement, and
lighting a candle, proceeded to unlock a small writing-desk, from
whence she drew some manuscript verses, which ran as follows:—

THE PREACHER’S ADDRESS TO THE SOUL.


Weary soul,
Why dost thou still disquiet
Thyself with senseless riot,
Taking thy fill and measure
Of earthly pleasure?
The things which thou dost prize
Are not realities;
All is but seeming.
Waking, thou still liest dreaming.
That which before thine eye
Now passeth, or hath past,
Is nought but vanity—
It cannot last.
This evil world, be sure,
Shall not endure.
Art thou a-weary, Soul, and dost thou cry
For rest? Wait, and thou soon shalt have
That thou dost crave,
For Death is real—the Grave no mockery.

THE SOUL’S REPLY.


Preacher, too dark thy mood;
God made this earth—
At its primeval birth
“God saw that it was good.”
And if through Adam’s sin
Death enter’d in,
Hath not Christ died to save
Me from the grave?
Repented sins for His sake are forgiven—
There is a heaven.
For that this earth is no abiding-place,
Shall we displace
The flowers that God hath scatter’d on our path—
The kindly hearth;
The smile of love still brightening as we come,
Making the desert, home;
The seventh day of rest, the poor man’s treasure
Of holy leisure;
Bright sunshine, happy birds, the joy of flowers?
Ah, no! this earth of ours
Was “very good,” and hath its blessings still;
And if we will,
We may be happy. Say, stern preacher, why
Should we then hate to live, or fear to die,
With Love for Time, Heaven for Eternity?

Rose perused them attentively, sighed deeply, and then resumed—


“Yes, he liked them, and said (I remember his very words) there
was more vigour and purpose about them than in the general run of
girlish verses. How could I find out whether they are worth
anything?” She paused in reflection, then clasping her hands
together suddenly, she exclaimed—
“Yes, of course, Mr. Frere; he was so good and kind about the
pictures, and Lewis says he is so very clever, he will tell me. But may
not he think it strange and odd in me to write to him? Had I better
consult mamma?”
But with the question came an instinctive consciousness that she
was about the last person whom it would be agreeable to consult on
such an occasion. Rose, like every other woman possessing the
slightest approach to the artist mind, felt a shrinking delicacy in
regard to what the Browning school would term her “utterances,”
which rendered the idea of showing them where they would not be
appreciated exquisitely painful to her. Now, Mrs. Arundel had a
disagreeable knack of occasionally brushing against a feeling so
rudely as to cause the unlucky originator thereof to experience a
mental twinge closely akin to the bodily sensation yclept toothache.
It will therefore be no matter of surprise to the reader to learn
that Rose, after mature deliberation, resolved to keep the fact of her
having applied to Mr. Frere a secret, at all events till such time as the
result should become known to her.
She accordingly selected such of her poetical effusions as she
deemed most worthy, in the course of which process she stumbled
upon a short prose sketch, the only thing of the sort she had ever
attempted, it being, in fact, a lively account of her first appearance
at a dinner-party, written for the benefit of a young lady friend, but
for some reason never sent. This, after looking at a page or two, she
was about to condemn as nonsense, when an idea came across her
that if Mr. Frere was to form a just estimate of her powers, it was
scarcely fair to select only the best things; so she popped in the
sketch of the dinner-party as a kind of destitution test, to show how
badly she could write.
Then came the most difficult part of the business—the letter to
Frere. True, she had written to him before, acting as her father’s
amanuensis, but that was a different sort of thing altogether. Still, it
must be done, and Rose was not a person to be deterred by
difficulties; so she took a sheet of paper and wrote “Sir” at the top
of it, and having done so, sat and looked at it till she became
intensely dissatisfied. “Sir”—it seemed so cold and uncomfortable; so
she took a second sheet and wrote, “Dear Sir.” Yes! that was better,
decidedly. She only hoped it was not too familiar in writing to a
young man; but then, Mr. Frere was not exactly a young man; he
was a great deal older than Lewis; above thirty most likely; and
three or four-and-thirty was quite middle-aged; so the “Dear Sir”
was allowed to remain.
“Ce n’est que le premier pas qui coute? and having once started, it
was not long before Rose’s nimble pen had covered two sides of the
sheet of paper, and the following letter was the result:—
“Dear Sir,—I know not how to offer any excuse for the trouble I
am about to give you, otherwise than by explaining the reasons
which have induced me to apply to you; and, as I know your time is
valuable, I will do so as briefly as I can. Do not think me forgetful of,
or ungrateful for, your great kindness to Lewis, when I tell you that
ever since I received my brother’s letter informing me of his
engagement as tutor to General Grant’s ward, I have felt miserable
at the idea of his working hard at an occupation which I fear must
be distasteful to him, in order to provide for Mamma and myself the
comforts we have hitherto enjoyed. It was impossible to prevent this
in any way, for we tried to shake his determination, but in vain. Now
I feel that I should be so much happier if I could assist, in ever so
small a degree, in relieving him from his burthen; and the only
possible idea that occurs to me (for he will not hear of my going out
as governess) is that I might be able to earn something by my pen.
With this view I have ventured to enclose for your perusal a few
verses which I have written at odd times for my own amusement;
and I trust to your kindness to tell me honestly whether they
possess any merit or not. I dare not hope your opinion will be
favourable; but if by possibility it should prove so, will you do me the
additional kindness of advising me what steps to take in order to get
them published. I have never been in London, but I have heard
there are a good many booksellers who live there; and as I dare say
you know them all, perhaps you would kindly tell me to which of
them you would recommend me to apply. I have not told Mamma
that I am writing, for, as I feel a presentiment that your answer will
only prove to me the folly of the hopes I am so silly as to indulge, it
is not worth while disturbing her about the matter. Once again
thanking you for your extreme kindness to Lewis, and hoping that
you will not consider me too troublesome in thus applying to you,
believe me to remain your sincerely obliged,
“Rose Arundel.
“P.S.—I have enclosed a little prose sketch with the verses, but I
am quite sure you will not like that. Perhaps, if Lewis has not left
you when this arrives, you will be so very kind as not to say any
thing to him about it, as he would be sure to laugh at me.”
When Rose had finished this epistle she felt that she had done
something towards attaining the object she had at heart, and went
to bed feeling more happy than she had done since the receipt of
Lewis’s letter. Straightway falling asleep, she dreamt that she was
introduced to Mr. Murray, who offered her £100 to write a short
biographical memoir of General Grant for the “Quarterly Review.”
CHAPTER XIV.—PRESENTS TOM
BRACY IN A NEW AND
INTERESTING ASPECT.

T
hree days passed by, and still poor Rose received no answer to
her letter, but remained a prey to alternate hopes and fears
and all “The gnawing torture of an anxious mind.” On the
fourth arrived the following characteristic note:—
“My dear Miss Arundel,—I dare say you’ve been abusing me like a
pick-pocket; at least I must have appeared to you deserving of such
abuse, for treating your request so cavalierly; but the fact is, I have
been down in a Cornish tin mine for the last two days, and only
received your packet on my arrival in town, an hour ago. And now to
business. I don’t set up for a judge of poetry, though I know what
pleases me and what doesn’t (I should be a donkey if I did not,
you’ll say); for instance, the present school of ‘suggestive’ poetry
doesn’t suit me at all. But then I have an old-fashioned prejudice in
favour of understanding what I read, and calling a railway
locomotive a ‘resonant steam eagle,’ for instance, does not tend to
simplify literature; the only thing such phrases ‘suggest’ to me is that
it would be a great deal better if the authors were content to stick to
plain English, and when they have such inexpressibly grand ideas,
not to trouble themselves to express them at all. Your verses have at
least one good point in them—they are so worded that a plain man
may understand them; in fact, all that I have yet read I like—the
feeling is invariably pure, true, and beautiful (your heart’s in the
right place, and no mistake); the language is well chosen, and
sometimes eloquent; there are, of course, plenty of places where it
becomes weak and young lady-like, but that was only to be
expected. We can’t all be men, unfortunately. I could not help
laughing when you ‘supposed I knew’ all the booksellers and
publishers in London, Heaven forbid! for in that case I should have a
very miscellaneous acquaintance. However, I do know several, and I
will go the first thing to-morrow morning and consult one of them—a
gentleman on whose judgment I can rely as to what will be the most
advisable course for us to pursue. I say us, because, as I don’t mean
to let the matter rest till I have succeeded, I consider myself a
partner in the concern. Lewis parted from me in high health and
very tolerable spirits. He left town, with General Grant, the same
morning on which I started for Cornwall. You shall hear from me
again when I can report progress. Don’t write any more nonsense
about giving me trouble: in the first place, the thing is no trouble; in
the second, I should not mind it one bit if it were.
“I am yours very truly,
“Richard Frere.”
The first thing next morning Frere called upon his friend the
publisher, who, as soon as he understood that nothing beyond
advice was required of him, became very communicative and
agreeable; glanced his eye over the verses and approved of them,
though he added, with a Burleigh-like shake of the head, that he
wished they were anything but poetry. Frere wondered why, and
asked him. In reply he learned that the public mind had acquired a
sadly practical bias, which leading him to suggest that poetry was
the very thing of all others to bring it right again, he was further
informed that the evil was much too deeply seated to be affected by
so weak an application as the poetry of the present day; and the
truth of this assertion appearing undeniable, the subject was
dropped.
“The best thing for you to do with these MSS., Mr. Frere,”
continued his adviser, “would be to get them inserted in some
popular periodical.”
“Well, I don’t object,” returned Frere. “Which had I better send
them to? There’s ‘Gently’s Miscellany,’ and the ‘New Weekly,’ and
‘Gainsworth’s Magazine,’ and half-a-dozen more of’em.”
“What do you suppose would be the result of adopting such a line
of conduct?” inquired his friend.
“Why, as the things are in themselves good, they’d probably put
’em in next month, and send a cheque for the amount, enclosed in a
polite note asking for more.”
“I fear not,” was the answer. “A very promising young friend of
mine sent a nicely written paper to the least exclusive of the
periodicals you have just mentioned; hearing nothing of it, he
ventured at the end of six months to write and inquire its fate. In
reply he received a note from the editor, which appeared to him
more explicit than satisfactory. It was couched in the following
laconic terms:—‘Declined with thanks.’”
“Phewl that’s pleasant,” rejoined Frere. “What would you advise,
then, under the circumstances? I place myself quite in your hands.”
His friend leaned back in his chair and considered the matter
deeply. At length he seemed to have hit upon some expedient, for
he muttered with great emphasis, “Yes, that might do. He could if he
would. Yes—certainly!” Then turning suddenly to Frere, he
exclaimed, “Mind, you’ll never breathe a word of it to any living
being!”
“Not for the world,” returned Frere. “And now, what is it?”
“You’ve heard of ‘Blunt’s Magazine’?”
“Yes; I’ve seen it in several places lately.”
“No doubt; it’s a most admirably conducted publication, and one
which is certain to become a great favourite with the public. Now I
happen to be acquainted with one of the gentlemen who edit it, and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like