PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$cbs = $_POST['cb'];
$query = "0";
foreach ($cb as $id => $checked)
{
if ($checked == 'on')
{
$query .= ", ".$id;
}
}
$query = "select data from table where id in (".$query.")";
Last edited by VladSun on Tue Aug 07, 2007 7:25 pm, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
$cbs = $_POST['cb'];
$query = "0"
foreach ($cb as $id => $checked)
{
if ($checked == 'on')
{
$query .= ", ".$id;
}
}
$query = "select data from table where id in (".$query.")";
You could do that by giving a 'value' attribute instead.
How can I loop through a var_dump? The user selects a certain amount of checkboxes, and I have it stored in an array. The above doesn't make sense to me, I do not have any variables named "$checked" or "$on".
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Because feyd told me to
Here's my code:
[syntax="html"]<form name=form1 method=post action=exe_send_mails.php>
<input type="checkbox" name="contact[]" value="1">1</td>
<input type="checkbox" name="contact[]" value="2">2</td>
<input type="checkbox" name="contact[]" value="3">3</td>
<input type="checkbox" name="contact[]" value="4">4</td>
<input type="checkbox" name="contact[]" value="5">5</td>
<input type=submit name=Submit value=Continue>
</form>
I need to see which ones were checked. Feyd said that on the exe_send_mails.php file, I should use POST data to get the contact[] array, then use var_dump(contact[]).
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
You lost me on this one...
here is what I have now:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]