1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Six fun things to add to your website

By

1.) The first thing you should defiantly be doing with PHP is updating any old pages to forward to their successors using a PHP forward. Setting up a PHP forward is super easy, it only takes a couple lines of code. You can use it both to update the URL of a page, or also to create "shortcut" urls for things that forward people on to the full URL. These are easier to include in printed materials. You can learn how to setup a PHP forward in this article.

2.) The next thing that you should be using PHP for on your website is e-mail forms. While I will admit that sometimes I find filling out an entire form just to e-mail someone can be a little bit annoying it servers two major purposes. The first purpose is to keep your e-mail address off your web page. This can cut down on SPAM a lot, because sometimes spiders will crawl the web looking for addresses to add to their lists that they in turn sell to spammers. The second reason is that you can ask very specific questions for people who want to contact you, to make sure you get all the information that you will need to help them.

3.) Countdowns are a super fun thing to add to your website. They actually work with a lot of different types of websites. You can count down to a birthday, a holiday, a concert date, your next big sale, etc. They can help build anticipation for an event, and if you sell something they can help show urgency to buy! They are also super easy to do with PHP. You can learn more about how to setup and use a countdown in this tutorial.

4.) There is an on again off again fad on the internet to count how many visitors have been to your website. One of the simplest ways to add a counter to your website is to use PHP. Every time someone visits your page the counter will move up by 1. This is a fun way to show how popular your website is. It is also a fun way to celebrate milestones on your website! If you are interested in learning how to create a simple counter in PHP you can do so with this tutorial.

5.) Advertisements are a great way to make money on your web site. Sometimes you have more than one great advertisement that you could include, or perhaps you want to try multiple different ads to see which generates the most revenue. A great way to do this is with a PHP banner rotation script. You can include more than one ad in the same space that changes all the time, so each will get an equal amount of time on the site. This is a great way to split up a limited advertising space or to test out different advertising opportunities.

6.) Another cool thing to do is to remind the user when their last visit to your site was. "Welcome back, you last visited us on October 5th" is kind of a cool greeting. It's actually very easy to do with PHP. You need to set a cookie in the user's browser with the date. When a person visits your site you just check to see if they have the cookie. If they do, you retrieve the date to see when their last visit was. You can use PHP to include this date on the page. To learn how to add the date to a user's cookies, have a look at this tutorial.

  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Learn PHP
  5. Six easy things to do in PHP on your website

©2014 About.com. All rights reserved.