Beginners PHP Tutorial
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Beginners PHP Tutorial

on

  • 3,425 views

 

Statistics

Views

Total Views
3,425
Views on SlideShare
3,302
Embed Views
123

Actions

Likes
1
Downloads
144
Comments
1

3 Embeds 123

http://co-labs.biz 118
http://www.slideshare.net 3
http://webandnewmedia.tumblr.com 2

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • very much useful to us
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Beginners PHP Tutorial Presentation Transcript

  • 1. A beginners tutorial in PHP
  • 2. Step 1:
    • To use PHP you’ll need a server to work on and test your page…
    • You may already have web space with PHP installed to work on,
    • Or you may already have a server installed on your system,
    • If not you’ll need to install one yourself….
  • 3. Installing a server:
    • An easy way to aquire an Apache server, along with PHP and MySQL built in (you’ll need these when using PHP), is using
    • WAMP (Windows) or,
    • MAMP (Mac) ( http:// www.mamp.info )
    • LAMP (Linux)
    • You can download WAMP at http://www.wampserver.com/en/
  • 4. Step 2:
    • Once you have followed the online instructions for installing and configuring WAMP, you need to check it works!
    • Open notepad (php can be added straight into your html) and type:
    • <html>
    • <head>
    • <title>PHP Test</title>
    • </head>
    • <body>
    • <?php echo '<p>Hello World</p>'; ?>
    • </body>
    • </html>
  • 5. Testing:
    • Save this as ‘hello.php’ in your ‘www’ folder located within your WAMP folder.
    • This can be done by selecting ‘all files’ when saving rather than the default ‘.txt’
    • (Note: you can also just type this script straight into a new document in Dreamweaver if preferred)
    • Now preview by opening your browser and entering http://localhost/hello.php
    • Your page should look like this…
  • 6.  
  • 7. Step 3: Variables
    • Variables will allow a value to be changed throughout your page without having to go through and find it every time you need it changed.
    • A variable can be defined by using ‘$’ at the beginning of your variable name. e.g. $variable = ‘value’
    • A variable must start with a letter or underscore and can only contain letters, numbers or underscores, and must not use spaces
  • 8. Variables: a simple example
    • <html>
    • <head>
    • <title>PHP Test</title>
    • </head>
    • <body>
    • <?php
    • $weather=&quot;sunny&quot;;
    • echo 'Hello World it’s ';
    • echo $weather;
    • ?>
    • </body>
    • </html>
    • Note: every line of PHP must end in ‘ ; ’
  • 9. The result should look like this:
  • 10. Now to experiment!
    • For more information on PHP and the next steps in learning syntax why not try:
    • http://www.w3schools.com/PHP/php_string.asp
    • http://www.webmonkey.com/tutorial/PHP_Tutorial_for_Beginners#Basic_Syntax
    • http://www.developphp.com/
  • 11. The End.