Knowledge Database
Tutorials > Advanced Web Hosting, PHP > Introduction to PHP - the basics of PHP coding Introduction to PHP - the basics of PHP codingPHP - Pretext Hyper Processor development language started in 1995. It was originally offered as a free toolset for very basic functions that we now take for granted on the internet. Back in 1995 the internet was newborn and such tools did not yet exist. PHP is an HTML-embedded scripting languageAdvantages over HTMLPHP is a dynamic language allowing changes to pages as input data changes. This allows the page to automatically update to provide the most relevant data. HTML is static and cannot change without manual intervention by the developer. Files with .php extensions are "executable" by webservers that can run PHP code. The Linux RSAWeb Webhosting servers run PHP with MySQL as a backend database to store information. The syntax of PHP is similar to other common languages C and Perl. If you have previous programming experience in either C/Perl/ASP you should be able to pick it up quite easily.PHP Basic CommandsTo display some information in PHP, you can do:Variables are using to hold information and are simple to assign. Variable names are prefixed by a $ sign. An array can be created by using square brackets after the variable name. Comments for single lines are // or for multiple lines /* COMMENT THIS */
FormsForms are used throughout PHP and are one of the building blocks on your website to make it more dynamic and interactive. Example of a form, it is in HTML, and then POSTs to the contact.php page which processes it:Then the contact.php form looks like this: Once a form is submitted, you can access the submitted variables using $_POST[variablename], it is not generally wise to use $_GET as it tends to be a bit insecure if not used correctly. Mathematical & Arithmetic OperationsAdding, subtracting etc are all easily achievable using PHP. Look below for examples.
Loops, Whiles, Fors etcThese controls allow you to loop through arrays, run repeat calculations and a mirad of other options.
Database IntegrationDatabase integration is what makes PHP extremely powerful. PHP can interface with many databases, but our preferred web hosting database for small websites to large corporate hosted applications is MySQL. Have a look at our MySQL tutorial for more information. PHP is an extremely power programming language, some of the basics have been outlined above. For a full function reference, please visit www.php.netSimilar Information from this category |


