Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically named variables

Status
Not open for further replies.

draigGoch

Programmer
Feb 10, 2005
166
GB
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.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top