Posted by Gerry Vandermaesen on 04/24/06 15:55
wesley@ispace.co.za wrote:
> I have tried that also. But the problem is that the value of the
> variable gets created dynamically.
> The problem is that i have an unlimited number of checkboxes on one
> page. So i am using an array to name them. I want to retriev the values
> from the checkboxes using another script. But, i cannot seem to
> retrieve these values.
so your HTML should be like
<form method="post" action="form.php">
<input type="checkbox" name="option[]" value="value 1" />
<input type="checkbox" name="option[]" value="value 2" />
<input type="checkbox" name="option[]" value="value 2" />
</form>
On the processing PHP page, the checked options are contained in an
array called $_POST['option']. You can run through all selected options
like this:
foreach ($_POST['option'] as $value) {
echo $value; // This will print out all selected values
}
Navigation:
[Reply to this message]
|