|
Posted by David on 07/08/06 10:22
On Fri, 7 Jul 2006 20:12:46 +0000 (UTC), Harold <harhem@cogeco.ca>
wrote:
>i still can not get the checkboxes to write to the database
>
>
>i have a table called skills with the following fields - skillid, fl_user
>
>This is how i have tyhe checkbox option written
>
><td><input type="checkbox" name="skill[]" value="16">
> Delphi</td>
>
>This code always comes up with the error message
>
> foreach ($_POST['skill'] as $skill) {
> mysql_query("INSERT INTO skills (skillid ,fl_user) " .
> "VALUES ($skill, userid)");
mysqlquery("INSERT INTO skills (skillid, fl_user) VALUES ($skill,
$userid)");
Where does userid get its' value from? Either you are trying to
insert the string 'userid' in to the db, or userid has a value
($userid). If it is from a POST. the ' $_POST[userid]'.
> $result = mysql_query($query) or die('Could not execute INSERT
>query');
> }
>
>
>
>What am i doing wrong??
Other than that, everything else looks okay. I personally would not
use [] in "input type="checkbox" name="skill[]" value
="16">--apparently it works, though.
David
Navigation:
[Reply to this message]
|