Hello,
Sorry for my english...
Well, I make a smaill website. members has to login and then member can see pictures (saved in a folder). When the admin upload pictures a folder wil be created. To get the actual folders in the "album" folder I use this code.
<?php
//get the folders
$handle = opendir(realpath('../album/Album/.'));
while ($direc = readdir($handle)) {
if($direc == '.' || $direc == '..')
continue;
else {
echo "\t\t<input type='checkbox' name='map[]' id='map[]' value='" . $direc. "' />" . $direc . "<br />\n";
}
}
closedir($handle);
?>
The admin has to assign the folders wich are allowed to see by a member. I use checkboxes for that.
And now my problem: When a member can see folder 1 to 4 and the admin upload 2 new folders and want to give that member to see these 2 new folders I want the following:
6 checkboxes (checkbox 1 > album 1, checkbox 2 > album 2... etc). As is said, this member can see folder 1 to 4, so in the CMS album 1 to 4 has to be checked ans album 5 to 6 not. This is my code for that:
<?php
$sql2 = "SELECT url FROM url WHERE gebruiker_id =" . $_GET['id'] . " ORDER BY url ASC";
$res2 = mysql_query($sql2);
while ($rij = mysql_fetch_array($res2)) {
$url = $rij['url'];
// mappen ophalen
$handle = opendir(realpath('../album/Album/.'));
while ($direc = readdir($handle)) {
if($direc == '.' || $direc == '..' || $direc == $url) {
continue;
}
echo "\t\t<input type='checkbox' name='map[]' id='map[]' value='" . $direc. "' />" . $direc . "<br />\n";
}
closedir($handle);
}
?>
Now my output is:
<input type='checkbox' name='map[]' id='map[]' value='album 2' />album 2<br />
<input type='checkbox' name='map[]' id='map[]' value='album 3' />album 3<br />
<input type='checkbox' name='map[]' id='map[]' value='album 4' />album 4<br />
<input type='checkbox' name='map[]' id='map[]' value='album 5' />album 5<br />
<input type='checkbox' name='map[]' id='map[]' value='album 6' />album 6<br />
<input type='checkbox' name='map[]' id='map[]' value='album 1' />album 1<br />
<input type='checkbox' name='map[]' id='map[]' value='album 2' />album 2<br />
<input type='checkbox' name='map[]' id='map[]' value='album 4' />album 4<br />
<input type='checkbox' name='map[]' id='map[]' value='album 5' />album 5<br />
<input type='checkbox' name='map[]' id='map[]' value='album 6' />album 6<br />
<input type='checkbox' name='map[]' id='map[]' value='album 1' />album 1<br />
<input type='checkbox' name='map[]' id='map[]' value='album 2' />album 2<br />
<input type='checkbox' name='map[]' id='map[]' value='album 3' />album 3<br />
<input type='checkbox' name='map[]' id='map[]' value='album 5' />album 5<br />
<input type='checkbox' name='map[]' id='map[]' value='album 6' />album 6<br />
What do I have to do to check the checkboxes (album 1-4) and not to check the album 5-6???
My guess it has to do with the While in While loop but...
Greetings,
Ferdi