[advanced search]
Results from the most recent live auction are here.
25 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Webmaster Tutorials
User Name
Password

Old 07-14-2004, 10:05 AM   · #1
ninedogger
DNOA Member
 
ninedogger's Avatar
 
Location: Iowa
Trader Rating: (38)
Join Date: Jun 2004
Posts: 655
NP$: 12.10 (Donate)
ninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of lightninedogger is a glorious beacon of light
Save The Children
Arrow PHP Beginners Guide

PHP is a server side language, and its not like javascript which is a client side language.

Section I - Using PHP
You can run PHP in basically 4 differen't ways.

<%
// Code in here
%>

<script language="php">
// Code in here
</script>

<?
// Code in here
?>

<?php
// Code in here
?>

I prefer the last method "<?php". You also may see "<?" be called shorttags.

Section II - Comments
There are bascically two ways that I do comments within the PHP code, they are:

<?php
// This is a comment
?>

<?php
/* Comment Line 1
Comment Line 2
*/
?>

As you probably can tell, the /* */ combo provides a multi line commenting system, while // privides a single line comment.

Section III - Display HTML
There are two very common ways to display text/html onto the webpage, print and echo. I prefer echo over print.
Example Usage:
print "<b>This is my bold text</b>";
echo "<b>This is my bold text</b>";

You might notice the ; symbol after those lines, its required after every line that you process data.

Section IV - Variables
Heres an example of giving a variable a value:
$name = "Jon";
And using what you learned earier try making it say on the screen:
Your name is Jon

To display variables in echo's or print's do this:
echo "Your name is $name";
or
echo "Your name is " . $name;

Thanks for reading and I hope it helps. Please remember that this is only a Beginning Guide to some simple features of PHP.

Stay tuned in the future for Tutorial #2 that will have how to do some more features.


Please register or log-in into NamePros to hide ads

Last edited by ps2gamer : 07-14-2004 at 04:00 PM.
ninedogger is offline  
  Reply With Quote
Old 07-14-2004, 06:49 PM   · #2
Ethan
Sheriff Of Nothing
 
Location: Florida
Trader Rating: (1)
Join Date: Apr 2004
Posts: 220
NP$: 45.10 (Donate)
Ethan is an unknown quantity at this point
Quick to the point, nice job.
__________________
Lowter.com - Webmaster eZine and Community
Interactive eZine, Articles, Blogs, and More
Norics.com | Cascading Design | Blue Programming
Ethan is offline   Reply With Quote
Old 09-02-2004, 07:16 PM   · #3
killaklown
Senior Member
 
Name: Justin
Location: Winnipeg, Canada
Trader Rating: (73)
Join Date: Oct 2003
Posts: 3,467
NP$: 0.06 (Donate)
killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold
thanks! for starting php u cant have too much
killaklown is offline   Reply With Quote
Old 10-25-2004, 01:35 AM   · #4
ToddW
NamePros Member
 
Trader Rating: (2)
Join Date: Dec 2003
Posts: 172
NP$: 6.01 (Donate)
ToddW is an unknown quantity at this point
Quote:
echo "Your name is " . $name;



Can also be written

echo "Your name is ".$name;

echo "Your name is ",$name;

If you must I suggest the comma as it's marginaly faster than the period.
But echo "Your name is $name"; works fastest.

Thought this would be good to add.
ToddW is offline   Reply With Quote
Old 10-30-2004, 11:02 AM   · #5
Peter
NamePros Staff
 
Peter's Avatar
 
Name: Peter McDonald
Location: Dundee, Scotland
Trader Rating: (41)
Join Date: Nov 2003
Posts: 3,914
NP$: 1414.60 (Donate)
Peter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud ofPeter has much to be proud of
Child Abuse Save The Children Save The Children
just a quick note regarding the following style tags

<%
// Code in here
%>

<script language="php">
// Code in here
</script>

these may not necessarily as they have to be enabled first however <?php ?> should always work.
__________________
I Recommend HIVE DESIGNS for high quality web designs

Formerly peter@flexiwebhost
Peter is online now   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Build your NameBrand Build your NameBrand Build your NameBrand
Advertise your business at NamePros
All times are GMT -7. The time now is 12:02 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0