Tell us what you look for in a web host!

Lots of Storage
Lots of Bandwidth
Free Domain Name
Free Set Up
Low Price
24/7 Support
Website Builder
Website Tutorial
Frontpage Exts
CGI-BIN
MySQL DBs
Lots of Email
Email Forwarding
Web Based E-mail
Unlimited Mailing        Lists
POP3 server
SMTP server
Autoresponders
SubDomains
FTP account
Web Based File        Manager
Perl support
PHP support
SSL support
SSI support
Bandwidth stats
Traffic stats
Password        protected dirs
Advanced Control        Panel
Custom ERROR        404 page
OC12 Connection
Stable Linux with        Apache Server

PHP MySQL
Interactive Website Design

Create a Simple Poll

PHP and MySQL make creating interactive websites easier than ever before. Here is a simple form and processing script which you can modify and use to poll your visitors. The form on the left is a modified version.

Create the database through your PHPMySQL Admin Panel or modify the birthday scripts to create a table with the 3 fields: color, code and number

This PHP script can be used to parse forms that use checkboxes for multiple selections like the one on the left. A sample form using radio buttons is provided below.

The bolded portion of the code loops through your user's selections, if there are more than one, and adds 1 to the selected field.

<?php
$db="mydatabase";
$link = mysql_connect("localhost");
if (! $link) die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
/*loop through the selected fields - multiple if using checkbox*/
foreach ($check as $value){
mysql_query("UPDATE simplepoll SET number=number+1 WHERE code LIKE '$value'");
}
//select the new updated values
$result = mysql_query( "SELECT color,number FROM simplepoll" ) or die("SELECT Error: ".mysql_error());
//display the updated results
$num_rows = mysql_num_rows($result);
print "<html><head><style type=text/css>
#poll{border-top :solid #004f9d 2px;border-left :solid #004f9d 2px} #poll tr td {border-bottom :solid #004f9d 2px;border-right :solid #004f9d 2px} #poll tr td {font-family: Small Fonts;font-style : normal ;font-size : 7pt; font-weight :bold } h3{font-family: Arial;font-style : normal ;font-size : 9pt; font-weight :bold;text-align : center; color :#FFFFFF;background-color :#004f9d }</style>
</head>
<body>
<table width=100%><tr valign=top><td>\n";
print "<table ID=poll cellspacing=0 cellpadding=5 width=125 >\n";
print "<tr valign=top><td colspan=2 bgcolor=#004f9d><h3>Other users chose these options.</h3></td></tr>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field )
print "\t<td>$field</td>\n";
print "</tr>\n";
}
print "</table>
</tr></table></body></html>\n";
mysql_close($link);
?>

The Form

The form is set in a table. We provide style sheet settings which can be placed in the head section of your document. This form uses single choice radio buttons. To change to multiple choice checkboxes simply change:
<dt><input type="radio" name="check[]" value="c1">
to
<dt><input type="checkbox" name="check[]" value="c1">

Place style sheets in head section:
#poll{ ;border-style : solid ;border-color : #004f9d ;border-width : 2px}
#poll tr td dt{font-family: Small Fonts;font-style : normal ;font-size : 7pt; font-weight :bold }


<table ID="poll" width="125" cellpadding="2" cellspacing="0" border="0">
<tr align="center" valign="top">
<td align="left" colspan="1" rowspan="1">
<h4>Select your favorite color.</h4>
<form method="POST" action="simple-poll.php">
<dl>
<dt><input type="radio" name="check[]" value="c1">Red<br>
<dt><input type="radio" name="check[]" value="c2">Green<br>
<dt><input type="radio" name="check[]" value="c3">Blue<br>
<dt><input type="radio" name="check[]" value="c4">Yellow<br>
</dl>
<input type="submit" value="Results"><input type="reset">
</form>
</td></tr></table>

Download the Scripts

The Birthdays Database management files can be downloaded in a zip file. The package contains an integrated db management system, with a simple login file and interface. To run the scripts on your PC you must have a localhost server installed along with PHP and the MySQL server.
Download birthdays_db.zip

MySQL Tutorial

To extend your knowledge of MySQL study the Docs and Tutorials at the official MySQL website. MYSQL.com