retrieve data using checkboxes

Given a MYSQL database where I have a table containing lots of entries structured as follows:

string | type

The field “type” can have 4 values (a, b, c, d) in the database.

I would like to use a checkbox form to retrieve all the string(s) from the database by checking one of the four possible values.

All I have so far is this piece of PHP code:

[php]<?
$checkbox = array();

if (isset($_POST[“type”])){
$checked = $_POST[“type”];

foreach ($checked as $value) {
echo “$value”."";
}
}
else{
echo “Please select at least one type.”;
}
?>[/php]

The problem is that this code returns only the type values a, b, c, d and not the strings of the entries in the database.

Can anybody out there tell me how to actually access my database entries and retrieve the string value which corresponds to the checked type in the form?

Thanks!

Sponsor our Newsletter | Privacy Policy | Terms of Service