Intro to PHP
    12/4/17
  1. We will look enough at PHP for you to understand what it is, be able to compare it to other server-side technologies (CFML, XML if it's extended further), and to write a script that accepts user input into a form and outputs some of that content either to another HTML/PHP page or to the page the form is on. We may also experiment with the mail() function.
  2. Dreamweaver understands PHP tags, and can also be set up to run them on the server. So that means you have to have your files FTPed to the web server (alpha.lasalle.edu). For our purposes, we should post them on the ALPHA server because the DArt server (csc-srv1.lasalle.edu) may not support PHP email.
  3. SO, what is PHP? It actually stood for "Personal Home Pages" but has now been called "Hypertext Preprocessor." Here is a good summary that introduces the idea and contains most of what you need to process the form. You will need Chapters 1 (Intro) and 2 (Tutorial). For a first try, run the <?php phpinfo(); ?> test in Chapter 2. You should see this(alpha) or this (DArt).
  4. Here are three lectures that introduce a first look at PHP including date methods, and cover forms and variables, and a brief one on the mail function.
  5. There are lots of deep forums, but this, which you've already seen, is the main one. One other place for quick tutorials is our friends at W3Schools (see their page on forms).
  6. Here is a form I built that passes variables to a second page with a drop-down menus and text boxes. A key issue is whether register_globals is turned on. If it's on, $name can be used as a variable. If it's off (generally as of PHP 4+) you need to declare variables as $name = $_POST['name'];
  7. PHP as an "inside-out" language can go back and forth between PHP and HTML tags. You should be able to use that to style a confirmation page that fits with the overall design of your site. Your final site must have a form that uses PHP.
  8. PHP also can create images on the fly through the GD (General Drawing?) module. Here is a simple design I did that is supposed to take user input.

Back to home page