Posted by Martie on 06/20/06 17:40
On Mon, 19 Jun 2006 20:03:36 +0000 (UTC), Harold wrote...
>
>
>keep in mind in am new to PHP.
>
>here is a snippet of some of the checkbox options...
>
><tr>
><td><input type=checkbox name=skill04/>Ad Design</td>
><td><input type=checkbox name=skill05/>Animation</td>
><td><input type=checkbox name=skill06/>ASP</td>
></tr>
>what i want to do is pass a userid( lets call that userid) along with
>any of the items that are checked only.
>
>
>
>
>userid is from a text box entry
>
>so if ad design and ASP are only selected i want both of them in the table
>
>user id | skill
>----------------
>123 | Ad design
>123 | ASP
>
>
>any help appreciated.
>
>Thanks
>
>
When using checkboxes, I believe only the checked selections are sent when the
form is being submitted. May want to consider adding something like "value=true"
to each of the checkboxes. That way when you can check the value before
inserting it into the table.
<?php
if($_POST['skill04'] == "true")
{
$selected_array[] = "skill04";
}
if($_POST['skill05'] == "true")
{
$selected_array[] = "skill05";
}
if($_POST['skill06'] == "true")
{
$selected_array[] = "skill06";
}
?>
That would give you and scalar/indexed array of only the selected items from
your form.
Martie
--
Unlimited Newsgroup Downloads / $19.95 month
More Details - http://newsguy.com/overview.htm
[Back to original message]
|