PHP - Scripting the easy way

PHP is an open source, cross platform scripting language that takes the best of Perl, Java, JavaScript and other languages. The language is designed explicitly for building web sites. PHP includes built in database connectivity as well as a variety of string manipulation functions and much more. PHP is designed to output HTML pages for use in browsers. Since it is server-side processing there is less browser dependency issues. Output good proper HTML and you will have fewer user (client browser) errors.

To learn more about PHP keep reading and go to:

 

Path to PHP on the YouGoWeb servers:  #!/usr/bin/php

PHP can be included in HTML documents, or entire files can be written in PHP. PHP allows for the same thing to be done in a number of ways which is good but understand that this tutorial is only a could examples. PHP is flexible to allow for you to do things may ways and they can all be correct. For example, both of these examples produce the same web page:


1) Example HTML with PHP embedded - Click here to test this script.

PHP code in blue

    <html>
    <head>
    <title>PHP Test 1</title>
   
    </head>
    <body>
   
    <?     # START OF PHP IS DENOTED WITH A "<?"
   
        # this is a comment
        # these lines print and format "PHP is Great"
   
        print "<center>";
        print "<h1>PHP is Great!<</h1>";
        print "</center>";

        # END OF PHP IS DENOTED WITH A "?>"

    ?>
   
   
    <hr>
   
    <p>The header of the page is overhead thanks to "PHP".</p>
   
    </body>
    </html>
   
   

2) You can see all of the information about the php system and the paths by creating the
following php test program.   -
Click here to test this script.



<html>

<?php

// Show all information, defaults to INFO_ALL
phpinfo();
phpinfo(INFO_ALL);

?>
</html>




CODING NOTE

Now that we have a simple PHP page working let's dicuss passsing variables in to HTML documents output by PHP scripts and databases from a web form.