Is there any way in php to change the names of variables dynamically?
I have got a page that displays a list of pictures and a checkbox with each - listing all pictures that need to be deleted off a site.
The name for the checkbox is the name for the file, these are then posted to a page that deletes the pictures with the checkbox ticked.
I want something like:
$gallery = $_GET['gallery'];
$dir = "../arbrofi/images/$gallery/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$count=-1;
while (($file = readdir($dh)) !== false) {
if ($fileCHK=ON) { <- eg $fileCHK = 'dscf0001CHK'
unlink ($file);
}
}
}
}
Any help would be appreciated
A computer always does what you tell it to, but rarely does what you want it to.....
I have got a page that displays a list of pictures and a checkbox with each - listing all pictures that need to be deleted off a site.
The name for the checkbox is the name for the file, these are then posted to a page that deletes the pictures with the checkbox ticked.
I want something like:
$gallery = $_GET['gallery'];
$dir = "../arbrofi/images/$gallery/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$count=-1;
while (($file = readdir($dh)) !== false) {
if ($fileCHK=ON) { <- eg $fileCHK = 'dscf0001CHK'
unlink ($file);
}
}
}
}
Any help would be appreciated
A computer always does what you tell it to, but rarely does what you want it to.....