Guide to PHP and MySQL (Computer Science 4 All Version)
Chapter 1: Introduction to PHP
PHP is a popular general-purpose scripting language that is especially suited to web development. (See php.net). PHP code runs on a web server unlike HTML or JavaScript which are handled by a web browser.
PHP code can be embedded in an HTML file usg the <?php
and ?>
tags.
Hello World!
Most beginning programmers start with the standard "Hello World" code:
An HTML/PHP Hello World Web Page
The rendered web page would look like this:
PHP Comments
PHP provides a few different way to add comments to your code. You can use multi-line comments or inline (single line) comments or PHPDoc comments. Comments should be used to explain what your code is doing. Comments should be used to provide a description of each function including whether there are parameters and whther the function returns a value or not.
Using download.php
Save this file (download.php) to your cs4hs web space. Then in your HTML code use this line:
Test to make sure it works for you.