Variables illustration

The current date and time is July 30th, 2010 5:29:PM

Companion Web Site

Larry Ullman has a web site devoted to PHP for the World Wide Web: Second Edition at this location.

It is intended as a supplement /complement to the book and has many helpful resources.

The Book

Variable image

PHP for the World Wide Web: Second Edition written by Larry Ullman

Chapter 1
Getting Started

Chapter 1 is a basic introduction to PHP and includes such ideas as posting a very small script to the server so that the server will print to the page all the information available about the PHP on that server. While taking PHP 101, I learned by using a similar, but shorter script, that the server I was using had version 4.2.1. The new server has 4.4.9 and I can move up to 5 if or when I want to do so.

Here is a link to a page which is reporting just what kind of PHP is on the server I now use, which is glowhost, and can be visited here. I am enjoying the cPanel which was non-existent on my last server, not to mention a whole lot of other things that were not available. The price is about the same and I have multiple domains residing in the same site. One is a new one I may use for publishing...well, not sure yet. The other, my son's business site, also resides there.

At the following link, you will find my test document which will print to the page the credentials of PHP on glowhost.

Server Test

Hello, world!

This is really going backwards, but sometimes, to go forward, backward is a good place to start! I know this will help reinforce what I have learned in PHP 101 and help to fill in any gaps that may have need of being filled in. Or ideas that may have been misunderstood (or be a bit foggy!) can be cleared up.

The book suggests using 'print' to send data to the browser, but I am going to continue to use 'echo' until I find I am wrong. Here is a link which debates the pros and cons for using 'print' or 'echo'.
Print or Echo?
I have read a few such sites and they all seem to say about the same thing.

The following was created by PHP and has no HTML formatting.
Hello, world!

The following was created by PHP and has been formatted.
Hello, world!

This will look the same as the others above, but the source code will be different because of adding an HTML comment.
Hello, world!

 


<?php 
/* My Variables for the study group site */
$book "<u>PHP for the World Wide Web: Second Edition</u>";
$author "Larry Ullman";
$myName "Joanne Johnson";
$pageTitle "PHP Study Group ";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pageTitle ?></title>


<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="common/ullman.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/ullmanMenu.css" rel="stylesheet" type="text/css" />
</head>

<body class="thrColHybHdr">

<div id="container">
  <div id="header">
    <h1><?php echo $pageTitle ?></h1>
    <p>Presented by <?php echo $myName ?><br />
    Started January, 2009<br />
    </p>
    <br />
  <!-- end #header --></div>
  <div id="sidebar1">
    <?php include("includes/nav.php"); ?>
    <p><img src="images/var.jpg" alt="Variables illustration" width="140" height="373"/></p>
    <p>The current date and time is <?php echo date ("F jS, Y g:i:A");?></p>
    
  <!-- end #sidebar1 --></div>
  <div id="sidebar2">
    <h3>Companion Web Site</h3>
    <p>Larry Ullman has a web site devoted to <?php echo $book ?> at this 
    <a href="http://www.dmcinsights.com/phpvqs2/" target="_blank">location</a>.</p>
    <p>It is intended as a supplement /complement to the book and has many 
    helpful resources.</p>
    <ul>
      <li><a href="http://www.dmcinsights.com/phpvqs2/errata.php">Errata</a></li>
      <li><a href="http://www.dmcinsights.com/phorum/list.php?10" target="_blank">Forum</a></li>
      <li><a href="http://blog.dmcinsights.com/" target="_blank">L. Ullman Blog</a></li>
      <li><a href="http://www.dmcinsights.com/bk_pages/faq.php?i=phpvqs2" target="_parent">FAQ</a></li>
      <li><a href="http://de.php.net/manual/en/manual.php" target="_blank">PHP Manual</a></li>
    </ul>
    <p><img src="images/book.jpg" alt="The Book" width="162" height="203" /></p>
    
    <div align="center"><img src="images/var.jpg" alt="Variable image" width="150" height="400" />
      </div>
  <!-- end #sidebar2 --></div>
  <div id="mainContent">
  <center><h3><?php echo $book ?> <span class="spanTitle" >written by</span> 
  <?php echo $author ?></h3>
    <h3>Chapter 1 <br />
      Getting Started</h3>
  </center>
    <p>Chapter 1 is a basic introduction to PHP and includes such ideas as posting a very small script to the server 
    so that the server will print to the page all the information available about the PHP on that server. While taking PHP 101, 
    I learned by using a similar, but shorter script, that the server I was using had version 4.2.1. The new server has <?php echo phpversion();?> 
    and I can move up to 5 if or when I want to do so.</p>
    
    <p>Here is a link to a page which is reporting just what kind of PHP is on the server I now use, which is glowhost, 
    and can be visited<a href="http://www.glowhost.com/" target="_blank"> here</a>. 
    I am enjoying the cPanel which was non-existent on my last server, not to mention a whole lot of other things that were not available. 
    The price is about the same and I have multiple domains residing in the same site. One is a new one I may use for 
    publishing...well, not sure yet. The other, my son's business site, also resides there.</p>
    
    <p>At the following link, you will find my test document which will print to the page the credentials of PHP on glowhost.</p>
    <p><a href="test.php" target="_blank">Server Test</a></p>
    
    <h2>Hello, world!</h2>
   
   <p>This is really going backwards, but sometimes, to go forward, backward is a good place to start! 
  I know this will help reinforce what I have learned in PHP 101 and help to fill in any gaps that may have need of being filled in.
   Or ideas that may have been misunderstood (or be a bit foggy!) can be cleared up.</p>
   
   <p>The book suggests using 'print' to send data to the browser, but I am going to continue to
    use 'echo' until I find I am wrong. Here is a link which debates the pros and cons for using 'print' or 'echo'. <br />
     
     <a href="http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=10006" target="_blank">Print or Echo?</a> <br />
     I have read a few such sites and they all seem to say about the same thing.</p>
   <p>The following was created by PHP and has no HTML formatting.<br />
       <?php echo "Hello, world!"?></p>
   <p>The following was created by PHP and has been formatted.<br />
    
    <?php /* In this example, escaping the quotation marks around red is done with
    the slash; also notice the html formatting inside of the php tags */
echo "<font color=\"red\">Hello, <big>world!</big></font>"
?>
    </p>
   <p>This will look the same as the others above, but the source code will be different because of adding an HTML comment.<br />
   <!--This is an HTML comment and will not be picked up and placed in the page when processed by the browser. -->
   <?php /* In this example, escaping the quotation marks around red is done with
    the slash; also notice the html formatting inside of the php tags */
echo "<font color=\"red\">Hello, <big>world!</big></font>"
?>
    </p>
   <p>&nbsp;</p>
   <!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the 
#mainContent div in order to force the #container div to 
contain all child floats --><br class="clearfloat" />
   <div id="footer">
    <p align="center">&copy;R. Joanne Johnson 2009 </p>
    <p align="center"><a href="http://validator.w3.org/check?uri=referer" target="_blank"><img
        src="http://www.w3.org/Icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Transitional" width="88" height="31" border="0" /></a></p>
  <!-- end #footer --></div>
<!-- end #container --></div>

<div id="sourceDiv">
  <?php  
   
/* shows the source code of the page */
    
show_source(basename($_SERVER['PHP_SELF'])); ?>    
   <?php  
   
/* shows source for nav bar include */
   
show_source("includes/nav.php");?>
</div>

</body>
</html>
<ul id="MenuBar1" class="MenuBarVertical">
          <li><a href="/ullmanBook/chapter1.php">Chapter 1</a></li>
      <li><a href="/ullmanBook/chapter2.php">Chapter 2</a></li>
  <li><a href="/ullmanBook/chapter3.php">Chapter 3</a> </li>
  <li><a href="/ullmanBook/chapter4.php">Chapter 4</a></li>
  <li><a href="/ullmanBook/chapter5.php">Chapter 5</a></li>
  <li><a href="/ullmanBook/chapter6.php">Chapter 6</a></li>
      <li><a href="/ullmanBook/chapter7.php">Chapter 7</a></li>
  <li><a href="#">Chapter 8</a></li>
      <li><a href="#">Chapter 9</a></li>
      <li><a href="#">Chapter 10</a></li>
      <li><a href="#">Chapter 11</a></li>
      <li><a href="#">Chapter 12</a></li>
      <li><a href="#">Chapter 13</a></li>
      <li><a href="/ullmanBook/index.php">Home</a></li>
       <li><a href="http://www.lzydaz.com/phpBB3/index.php" target="_blank">Hello World</a></li>
       <li><a href="http://www.lzydaz.com/studygroup/php/index.php" target="_blank">Bonnie</a></li>
       <li><a href="http://www.amaraland.com/studyGroup/index.php" target="_blank">Kc Ladybug</a></li>
       <li><a href="http://krisse.tuna.fi/phpwww/ch1.php" target="_blank">Krisse</a></li>
       
       
    </ul>