To start off are PHP tutorial we will start by making a very simple “Hello World!” script.
So, open up notepad++ and create a new page. Type the following:
<?php echo "Hello World!”; ?>
Press save as and save it as “Tutorial 1 - Hello World!.php” save it to this directory: “(drive letter where you installed xampp):\xampp\htdocs\tutorials”.
Make sure xampp is open and apache and MySQL are running. Go to your web browser and type: localhost:2375/tutorials or localhost:80/tutorials depending on which you have and press enter. Then click “Tutorial 1 - Hello World!.php” and watch Hello World! be in your web browser! Now let’s go over what we told PHP to do.
The: <?php and the ?> are the tags that every PHP form start and end with. So, get used to typing it in!
echo “Hello World!”; tells PHP to echo out Hello World! in the web browser.
If you type this code in:
<?php echo "Hello World!”; echo "Hello World!”; ?>
And save it, and refresh your webpage it will show as Hello World!Hello World! because there is no break. A break is a basic html code that puts text onto different lines. To do this all we have to do is add:
<?php echo "Hello World!”; ‘<br>’ echo "Hello World!”; ?>
See the difference? I added ‘<br>’. That’s it! This is the end of the first tutorial. The second tutorial should be available in a few days.
Edited by {IP}Apollo, 09 April 2012 - 08:12 PM.