Dummy question about knowing marked checkboes
| From: | Mário Gamito | Date: | Sun, 29 May 2005 07:50:13 +0000 |
| Subject: | Dummy question about knowing marked checkboes | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-215957@lists.php.net to get a copy of this message | ||
Hi,
First of all, my apologies to all list members for this dummy question.
I've made my home work before posting here, but the truth is that i
didn't found an answer for such a simple question.
Only examples of more sophisticated related things.
I have this piece of code that produces various checkboxes inside a form:
-------------------------------------------------------------------
// select interesses names and values to build the chekboxes
$recordSet = &$conn->Execute('SELECT interesses FROM interesses ORDER BY
interesses ASC');
// build the checkboxe's list
if (!$recordSet)
print $conn->ErrorMsg();
else {
while (!$recordSet->EOF) {
print($recordSet->fields[0] . '<input name=\'interesses\'
type=\'checkbox\' id=\'interesses\' value=' . $recordSet->fields[0] .
'\'>');
echo"<br />";
$recordSet->MoveNext();
}
$recordSet->Close();
$conn->Close();
}
---------------------------------------------------------------------
Here's the correspondent HTML output:
---------------------------------------------------------------------
Alojamento<input name='interesses' type='checkbox' id='interesses'
value=Alojamento'><br />
Artesanato<input name='interesses' type='checkbox' id='interesses'
value=Artesanato'><br />
Eventos<input name='interesses' type='checkbox' id='interesses'
value=Eventos'>
(etc.)
---------------------------------------------------------------------
My dummy question, for which i apologise once more is: after submitting
the form, how can i know which chekboxes were checked ?
Thanking you in advance.
Warm Regards,
Mário Gamito