There are no comments yet...Kick things off by filling out the form below.
Often times, website owners benefit from feedback based upon user interests, preferences and ideas. While usability testing can be an expensive, long process, you can integrate a basic review script into each of your pages to get real time feedback from your customers. The primary benefit is that your users will enjoy giving your feedback on the site, which you can then use to vastly improve its construction. This guide provides a basic outline of how you might pursue building a PHP-based review feature into your site, although the actual implementation requires more details.
In general, when adding new features to your site, you can approach it in a modular fashion: each feature should be nested within your existing application design. This way you don’t have to build out a separate database and core application to add new features. This tutorial assumes we’re using a mySQL database (although any open source SQL database will work.) You’ll want to create a new table in your existing SQL database to capture these variables, since it’s much easier to store and work with them in this format. To begin with, we create a framework for the database and then proceed to analyze how we might integrate the code in with our full feature set.
CREATE TABLE rate (id INT(3) AUTO_INCREMENT PRIMARY KEY, page VARCHAR(20), value INTEGER, ratings INTEGER)
In order to start working with the database we’ll need to propagate it with an initial set of data:
INSERT INTO rate (page, value, ratings) VALUES ( "Home", 35, 9 ), ( "News", 19, 3 ), ( "Contact", 15, 8 ), ( "Services", 10, 3 )
According to these commands, we entered the total aggregate ratings and number of votes for each of the five major pages on our site, which provides a way to begin to analyze the average votes, most popular pages as well as other data that can be valuable for us in PHP. Now the key is to link the database to on-site scripting which allows us to get more out of each page. In particular, we can add a vote script that writes to the database within the site:
<?php
mysql_connect("ip.host.com", "user", "pw");
mysql_select_db("db_name");
$data = mysql_query("SELECT * FROM rate");
while($rate = mysql_fetch_array( $data ))
{
echo "Rate Page: " .$rate['name']."<br>";
echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=1&id=".
$ratings[id]."> Poor</a> | ";
echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=3&id=".
$ratings[id].">Average</a> | ";
echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=5&id=".
$ratings[id].">Good</a><p>";
}
?>
By implementing this basic script you have a way to begin writing code more effectively, and can add a variety of fields to your array to capture more user feedback such as ratings for elements of the page such as layout, style, design and information.
With this basic script you can begin crafting an even larger set of options to help you get user feedback and improve your site. The combination of PHP and mySQL databases is quite popular and provides a way to build dynamic sites with impressive amounts and types of information. If you’re looking to add user functionality to your site, PHP is a great scripting language to get started with.
There are no comments yet...Kick things off by filling out the form below.
| 1 | JustHost - £1.95 |
| 2 | iPage - £1.99 |
| 3 | HeartInternet - £2.49 |
| 4 | WebHostingHub - $4.95 |
| 5 | HostGator - $4.95 |
| 6 | InMotion Hosting - $5.95 |
| 7 | FatCow - $3.67 |
| 8 | GreenGeeks - $4.95 |
| 9 | BlueHost - $6.95 |
| 10 | GoDaddy - $4.31 |