In the submission data, checkboxes are either present or not - present
if checked - not present if not checked
your going to need to loop through the $_POST vars to find out if any
are present.
There are many ways to skin this cat - personally, I would use a generic
name for the checkbox field like name='cb$a', then loop through the
$_POST vars for any that start with 'cb', then extract the rest of the
name to determine which checkbox it is (i.e. your $a value).
Grant wrote:
>
> I'm still trying to figure out how to display text for an "onchange" event
> that warns the user "Data changed" next to each field before they click to
> update.
>
> But I'm also trying to figure out how to retrieve a value from a checkbox
> array. Basically I have a loop that displays all pictures in a directory
> with a certain file name, and I want the user to be able to check the
> box to
> select which pictures they want to display. How do I save and then
> retrieve
> the values in this checkbox array?
>
> while ($file = readdir($openedDirectory))
>
> if($file != "." && $file != ".." && $file != "Thumbs.db" && $file !=
> "index.html" && $file != "index.php")
> {
> $sevenLeftChar = substr($file, 0, 7);
> if ($sevenLeftChar == $MLSNumber)
> {
> $totalPictures++;
> echo "<a href = '/rentals/pictures/$file'>$file</a>";
> echo "<img border='0' src='/rentals/pictures/$file' width='72'
> height='54'><br></br>";
> echo "<input type='checkbox' value='$pictures[$a]' name='$pictures[$a]'>:
> $file <br />";
> $a++;
> echo "$pictures[$a]";
> }
> }
> Grant
>
> [Non-text portions of this message have been removed]
>
>
------------------------------------
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning. Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php_mysql/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/