Back to the Index | Page 2

BASIC PHP

LET'S GET STARTED

The first thing I would like you to do is view this page. It is a simple page that says: "Hello students!".

Check out the source code - what do you notice?

Now click here to view the code for that page.

Things to note:

  • PHP code can be placed anywhere inside of an HTML document
  • All PHP code must be enclosed between "<?php" and "?>"
  • The PHP function "echo" is similar to Javascript's "document.write()" in that it will print things to the HTML file for display.
  • Link to more information on the "echo" function.

    OUR ASSIGNMENTS

    1. Make a folder called "php" in your web_design folder.
    2. You will save all your PHP pages to this folder with the extension ".php"

    Assignment #1 - Name your file php1.php (be sure to save it in the correct folder)

    Create an HTML file that uses the PHP echo function to display a page with the title "My First PHP Page" and in the body "This message was printed using PHP's echo function."