Back to DFS's Workshop Page
Back to Agenda Page


Generating a Full HTML Page

Again, your new script will generate the traditional "Hello, World!" greeting. However, this time you will only use PHP to generate an HTML web page on the fly. Follow the simple steps below.

  1. Get to the directory where you are storing your PHP code.

  2. Create a new file called helloworld2.php so that it looks like the following code.

    <?php
    // PHP echoing "Hello World in HTML"
    // Using Newline character
    // helloworld2.php
    echo "<html>\n";
    echo " <head>\n";
    echo "  <title>Hello World in HTML</title>\n";
    echo " </head>\n";
    echo " <body>\n";
    echo "  <p>Hello, World!</p>\n";
    echo " </body>\n";
    echo "</html>\n";
    ?>
    
    
  3. In your favorite web browser, type

    http://localhost/~YOURID/test_php/helloworld2.php
    where YOURID is the user ID you have on the system.

Notes


© DFStermole: 2003
Created: 3 May 03
Last Modified: 3 May 03