Read Building Web Sites All-in-One For Dummies® Online
Authors: Claudia Snell
Listing 2-1: Summoning the PHP Page
We are maintaining a mailing list to notify visitors when new content is added to the site.
To be added to our mailing list, fill in the form.
PRIVACY NOTICE: Your E mail address will not be forwarded to third parties. It will only be used to notify you
when new material is posted on our site.
Your Name:
Your E Mail:
Â
Forwarding the information to a database
Most Web hosting services make it possible for you to quickly set up a database through their control panel. When you set up a database, you define the fields that store the information. Figure 2-17 shows a database as set up through a hosting service's control panel. Listing 2-2 shows the PHP code needed to connect to the database.
Figure 2-17:The Web hosting service's control panel made this database possible.
Listing 2-2: Forwarding the Information to a Database
$name=$_POST[âName'];
$E_Mail=$_POST[âE_Mail'];
$connection=mysql_connect (“mywebhostingservice.com”, “myusername”, “mypassword”) or die (âI cannot connect to the database.');
mysql_select_db (“mydatabase”,$connection) or die( “Unable to select database”);
$query = “INSERT INTO `Mailing_list` (`ID`, `Name`, `E_Mail`) VALUES (â','$Name','$E_Mail')”;
mysql_query($query);
mysql_close();
?>
A full dissertation in PHP code is beyond the scope of this book. We do, however, explain how the code makes it possible to connect to the database and transfer the data. The objects with the dollar sign ($) before them are variables. The variable$nameis set as equal to$_POST[âName']. In other words, the code is posting the name entered by the customer. The variable$E_Mailis set equal to the e-mail address entered by the customer on the mailing list form. The line of code that begins with$connectionmakes the connection to the database. The line of code that begins with$queryinserts the data into the mailing list. For more information on PHP and MySQL databases, check outPHP & MySQL For Dummies,3rd Edition, by Janet Valade, orPHP & MySQL Web Development All-in-One Desk Reference For Dummies,by Janet Valade, Tricia Ballad, and Bill Ballad (both published by Wiley).
Test, test, and then test again
After your e-commerce site is created, test the site to make sure everything works. Yes, we know, this is just common sense. But an e-commerce site does have items that are not found on garden-variety Web sites. The following list shows the obvious â and not so obvious â things for which you need to test:
â¢Make sure all the links work.
â¢Time the pages as they download.If any page doesn't download in less than 12 seconds, optimize the graphics until it does. Alternatively, delete graphics you don't need. If possible, strive for pages that download in 8 seconds or less.
â¢Test the pages using the type of Internet connection the majority of your clients' intended audience will be using.
â¢If the site uses forms that submit information to a database, test the form to make sure the data makes the trip to the database.
â¢Test the site on real users.While the site is still under development, invite employees of your client and your friends to test the beta version of the site. Create a customer survey form to get feedback from your beta testers and incorporate this feedback in future iterations of your design.
After securing a server for the e-commerce site, create a generic home page to let people who find the site before it goes public know what they can expect. Create a separate folder âTestis a logical name â on the server to store the site while you're creating it. After you finish testing the site, transfer the pages and associated folders to therootdirectory for the site.
Selling Online
After you test the e-commerce site, your client is ready to dive into the deep end of the pool and begin selling his wares. Selling online is like selling from a bricks-and-mortar operation. Your client can stock the best-looking shop in town with the finest goods, but if he doesn't promote it, the business will fail. Security is another concern. Web sites are vulnerable to hackers, scams, and so on. And then there's the matter of the customer, who is the very reason the e-commerce site exists. Getting sales is one thing, but getting customers to come back again is a different story. Not getting customers to return is another reason businesses fail.
If you build it they won't care
So you set up a fancy e-commerce site with all the bells and whistles that the law allows. And you think that just because the site's the coolest thing since sliced bread, it will be overcome with visitors who place large orders. Well, dream on, because that won't happen. No one will care about your Web site â until you give them a reason to care. And they won't have a reason to care if they can't find you. The only way you can attract traffic to your Web site is to get the word out. Many Web site owners spend copious amounts of money employing online marketing and search engine optimization companies. (These methods of promotion are covered in Chapter 3 of this minibook.) However, here are a couple of things a Web site owner can do to get the word out:
â¢Send out a press release.Many local newspapers will let you post a free press release. Lots of online companies specialize in press releases as well. Typefreepress releasein your favorite search engine and you'll come up with Web sites specializing in press releases. Typepress releaseand you'll find information on how to write a press release.
â¢Add your URL to your business cards, letterheads, and other written literature.Include the URL in your e-mail signature.
â¢Have the site featured in online and traditional business directories.Let your fingers do the walking and typeonline business directoriesin your favorite search engine. You'll end up with more than enough results.
â¢Submit the site to search engines.Many Web hosting services enable you to submit a site through their control panel. If not, navigate to your favorite search engines and look for a link that reads, “Submit a URL” or something similar. Follow the prompts to submit the site.
â¢Create cross-links with other sites.Links help a site's rank with search engines. Encourage your client to write the Webmaster of other popular Web sites asking for permission to link to their site and vice versa. This one-hand-washes-the-other form of linking draws visitors from your site to theirs and vice versa.
â¢Market the site's merchandise through other Web sites.A network of affiliates that sell similar items or services can expand the sales of any e-commerce site. The affiliate creates links to merchandise on your client's site. The affiliate gets a commission for each sale.
â¢Provide free information.If your client's site targets a certain niche market, such as photographers, free tutorials give potential customers a reason to return. For this technique to work, the information must be of value to the target group and must be updated frequently. Tell your client to visit forums associated with the niche market and answer users' questions. In the signature of the message, include the URL to the e-commerce site along with a description of the free information available.
â¢If your client has promotional funds, consider using a pay per click option offered by some search engines.The search engine company charges a fee for each click to your client's site with a particular keyword phrase. For example, if your client is a wedding photographer in Houston, the obvious keyword phrase to choose for a pay per click would beHouston Wedding Photographer.
â¢Use search engine ads.Many Web sites offer ads on the right side of the results page. The ads that appear in the results page are relevant to the keywords entered by the search engine visitor.
â¢Advertise the site in print media such as trade publications associated with the product being sold from the e-commerce site.
Security concerns
The Internet can be a nasty place. Web site owners have to contend with hackers, online theft, fraud, and viruses, to name a few. Any owner of an e-commerce site must be prepared for problems. In addition to these security issues, you must consider security for e-commerce transactions as discussed in the previous chapter of this minibook. Here are a few things that you can do to bolster the security of any e-commerce site:
â¢Add a copyright notice to the bottom of each page.
â¢If your client is a photographer or is selling fine art online, make sure each image bears either the copyright symbol and the name of the creator or a watermark.Furthermore, you can incorporate JavaScript on the page, which prevents visitors from right-clicking an image and downloading it to their computer.
â¢To prevent high-resolution images from being downloaded, use JavaScript to implement an image swap when users mouse over the image.The replacement image can either be a warning that copyright laws protect the image, or it can be a low-resolution version of the same image that the visitor would not want to download.
â¢Copy all your client's Web site files to CD or DVD.If the server's equipment crashes or a hacker destroys the site, you can quickly get your client up and running again by uploading the files to the server. Archival CDs or DVDs are the best bet. However, these are quite expensive. If you use them, make sure your rates reflect the added expense. Alternatively, you can use media from a quality manufacturer like Memorex, which should last for a long time.
â¢Advise your client to protect business computers with firewall and antivirus software.This prevents hackers from accessing your client's business records or sending virus-laden e-mails to your client.
â¢Advise the client to install some sort of anti-spam software on the business computers.Spammers are relentless, and your client's e-mail addresses are up for grabs after the site is live.
â¢Make sure the Web hosting service has adequate protection.Hackers often know how to access hosting service control panels. A successful attack on an e-commerce site through a control panel can be devastating. For example, the hacker can clean out your client's database.