Once you get the web server set up you can begin writing your scripts. If you are using XAMPP you can just edit the files right on your hard drive and then browse to the location. If you have a remote web server you must upload the files after you edit them with an FTP client.
Here is a short PHP script that will display a webpage.
echo "Hi this is my webpage";
?>
You may be wondering why you would even use PHP to do this. The example above only displays HTML code, but using variables and extra functions you can create something a little more fun. You can create sessions to allow for variables to be saved when users change pages on your site, and using this you can have users log into your site. Anytime you have to log into a website, sessions are used. Sessions are not restricted to PHP, but PHP has support for them.
Try the following, it adds two variables into another variable then displays the result.
@session_name('scoder');
@session_cache_expire(99999);
@session_start();
$c=$_SESSION["c"];
$a=4; $b=1;
$c=$c+$a+$b;
echo "$c";
$_SESSION["c"]=$c;?>
The result will be 5. If you refresh the page it will add 5. So if you refreshed it 5 times, it would display 25.
Now try this.
echo getenv("REMOTE_ADDR");
?>
You will see your own IP Address, which can be very handy. This is what gets logged on the web servers whenever you visit a site.
Once you get familiar with the basics of PHP things will become more easy. You can connect to databases and make your web site come alive using the built in PHP MySQL functions.
This is only a very short example of what can be done with PHP. There is so much more you can do with the language that can not be summarized. I recommend you visit www.php.net for more information if you are interested in learning more.
Published by SethCoder
I work with a lot of different technologies and have certifications on a number of various electronics systems. I am in the United States Air Force, and my job is known as Cyber Transport Systems Specialist... View profile
How to Write Articles that SellOne of the most effective ways to bring attention to your product or service is through the use of article marketing. This article provides effective writing techniques and reso...
How to Publicize Your Writing Before You Publish ItWhy pay for pubicity when you can promote your writing before you launch it in the media or publish it by using social smarts?- How to Make a Facebook Application Using Widgetbox to Promote Your Articles on ACYou work really hard writing great content, why should you have to work so hard to promote it? If there is a lazy way to increase readership that requires very little from you, would you do it? Absolutely! The catch?...
- Understanding Web Server Log FIlesMore and more people are buying hosting for their web sites that provide web server log files for analysis. This information can help you see how people are using your web site, which will help you develop a more user...
- How to Set Up Your Own WebsitesThis text will guide you to set up your own websites!
- PHP and Web Hosting with Mac
- How to Produce Good and Resource-friendly PHP Code
- How to Make a Webpage Using HTML - Part I
- Essential HTML Basics and a Short How-To for Homebrew Web Pages
- How to Write an Effective Web Article
- Commercial Aspects for Horizontal Web Page Menus
- How to Put a Search Engine on Your Website



