Firstly, you should be giving the checkboxes different ids - the id 
needs to be unique within the page.

In your $_GET or $_POST array you will get an array cboPictures 
containing all the checked values. There are many ways to access it 
depending on what you want to do. Have a look here:

http://www.php.net/manual/en/ref.array.php

Try this code at the start of your script so you can see exactly what 
you've got:

echo "<pre>";
print_r ($_REQUEST);
echo "</pre>";

PT


Grant wrote:
> But how do you reference the checkbox if it uses an array?
> 
> If a checkbox is contained within a loop, it is unknown how many checkboxes
> will be displayed. Therefore, the variable name itself would have to be an
> array, right? If I already know the amount of checkboxes, I can give them
> each a name, and that's simple.
> 
> But in this case,the difficulty is when the checkbox is inside a loop. I
> can't figure out the code for this...
> 
> <input type='checkbox' id='checkbox' value-'$file' name='cboPictures[]'>
> 
> Grant
> 
> On Thu, Apr 1, 2010 at 2:14 PM, Michael <[email protected]> wrote:
> 
>>
>> IIRC, in the $_POST data, checkboxes are either present if checked and
>> not present if not checked.
>>
>>
>> Grant wrote:
>>> After spending so much time with the HTML code, I'm surprised at how easy
>> it
>>> is becoming to manually code HTML. I mainly use frontpage for quick
>>> references..I'll change to a color and see what the hexadecimal value is.
>> Or
>>> I'll design a table and copy the code that it created. I also use
>>> dreamweaver now...I sometimes use notepad but debugging is time-consuming
>>> when an error is on line 500...ha
>>>
>>> Can anyone help me figure out how to retrieve a checkbox array and then
>>> retrieve those values?
>>>
>>> I have a loop that displays every picture in a certain directory that
>> start
>>> with a certain MLS number such as 1234567_10.15.jpg, 1234567_13_19.jpg,
>> and
>>> so on. If it pulls 5 pictures, I would like a checkbox by each. I would
>> like
>>> to simply click the checkbox to indicate that I want to assign the
>> picture
>>> to the listing. Then I would like to add this value into a textbox called
>>> picture1, picture2, picture3, etc.
>>>
>>> while ($file = readdir($openedDirectory))
>>>
>>> <input type='checkbox' id='checkbox' value-'$file' name='cboPictures[]'>
>>> I can get it to display a checkbox, but I don't know how to store and
>>> retrieve the values. I understand the concept of arrays, but don't
>>> understand them in PHP. How to access the values once I figure out how to
>>> store them? I've spent a lot of time trying to figure this out.
>>>
>>> Grant
>>>
>>>
>> [Non-text portions of this message have been removed]
>>
>>  
>>
> 
> 
> 

Reply via email to