NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > Webmaster Tutorials
Reload this Page PHP Beginners Guide

Webmaster Tutorials Instructional webmaster-related how-to's and tutorials.

Advanced Search
0 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 07-14-2004, 10:05 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
nick's Avatar
Join Date: Jun 2004
Location: Iowa City
Posts: 703
nick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud ofnick has much to be proud of
 


Save The Children

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:

????: NamePros.com http://www.namepros.com/webmaster-tutorials/38763-php-beginners-guide.html
<?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.
Last edited by nick; 07-14-2004 at 04:00 PM.
nick is offline  
Old 07-14-2004, 06:49 PM   #2 (permalink)
Sheriff Of Nothing
Join Date: Apr 2004
Location: Florida
Posts: 220
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  
Old 09-02-2004, 07:16 PM   #3 (permalink)
Senior Member
 
killaklown's Avatar
Join Date: Oct 2003
Posts: 3,472
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 beholdkillaklown is a splendid one to behold
 



thanks! for starting php u cant have too much
killaklown is offline  
Old 10-25-2004, 01:35 AM   #4 (permalink)
NamePros Member
Join Date: Dec 2003
Posts: 171
ToddW is an unknown quantity at this point
 



Quote:
echo "Your name is " . $name;
Can also be written
????: NamePros.com http://www.namepros.com/showthread.php?t=38763

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  
Old 10-30-2004, 11:02 AM   #5 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,074
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
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.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 01:01 AM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger