i tend to use the scripts on hotscripts as a learning tool, i try to write all my own code rather than actually use the scripts.
anyway, here goes:-
1) The Form - selection.html
============================================
<html>
<head>
<title>test form</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<form action="content.php" method="post">
Selection 1: <input type="checkbox" name="selection1" value="yes"><br><br>
Selection 2: <input type="checkbox" name="selection2" value="yes"><br><br>
Selection 3: <input type="checkbox" name="selection3" value="yes"><br><br>
Selection 4: <input type="checkbox" name="selection4" value="yes"><br><br>
Selection 5: <input type="checkbox" name="selection5" value="yes"><br><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset"></td>
</form>
</body>
</html>
2) The Script - content.php
============================================
**remember to embed this in the html, and name the file content.php**
<?php
//Take the form fields and turn them into variables
$selection1 = $_POST['selection1'];
$selection2 = $_POST['selection2'];
$selection3 = $_POST['selection3'];
$selection4 = $_POST['selection4'];
$selection5 = $_POST['selection5'];
// Define MySQL connection settings - Alter to suit your own
$host = "localhost";
$username = "username";
$password = "password";
$database = "database";
//Pull the relevant data out of the database and store it into the variable $result
mysql_connect($host,$username,$password) or die("Unable to connect to database");
@mysql_select_db("$database") or die("Unable to select database $database");
$sqlquery = "SELECT choice1,choice2,choice3,choice4,choice5 FROM database_table";
$result = mysql_query($sqlquery);
//Take the values from $result and store them in seperate variables
$row = mysql_fetch_array($result);
$data1 = $row['choice1'];
$data2 = $row['choice2'];
$data3 = $row['choice3'];
$data4 = $row['choice4'];
$data5 = $row['choice5'];
//Print the data for each choice if the variable has a value
if ($selection1 == "yes") { print "$data1<br><br>"; }
if ($selection2 == "yes") { print "$data2<br><br>"; }
if ($selection3 == "yes") { print "$data3<br><br>"; }
if ($selection4 == "yes") { print "$data4<br><br>"; }
if ($selection5 == "yes") { print "$data5<br><br>"; }
// Print error message if the table is empty
if(mysql_num_rows($result)<1){
echo "There are no records in the database!";
}
mysql_free_result($result);
mysql_close();
?>