Monday 14 March 2011

Programming - Introduction

In this blog we will be looking at how to create a server side script. As discussed earlier, there are a number of scripting languages available to us. Due to its simplicity and popularity within the industry we will be using PHP.

To create a PHP script you only need a text editor and an FTP client to copy your script up to your web server. This is where the script will run, and produce the output sent to the client machine.

Any editor will do, it is common on a windows system to use notepad, but I would recommend that you down load and use the editor “notepad-plus-plus” as this has some enhanced feature that will make writing scripts easier. If you are going to use notepad++ please remember to set the language to PHP.

In PHP the script code can be written within the HTML, but the page has to have the extension “.PHP” so that the server knows to process it before sending it to the client.

Therefore all PHP will be within the tag <?php ...?>

e.g.

<?php
     echo "Hello World";
?>

You can build HTML structures within you PHP. These structures can be dependent on external data, from databases, file, or ERP systems.

<?php
     echo "<table width='200' border='1'>";
     ...
     echo "</table>";
?>

As shown above scripts use inbult functions to tailer the outputed HTML for the client.

No comments:

Post a Comment