giving a defined variable an option

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
glennn3
Forum Commoner
Posts: 63
Joined: Sat Sep 20, 2003 8:43 pm

giving a defined variable an option

Post by glennn3 »

having this (an upload directory):

Code: Select all

define ("BASEFOLDER", $baseFolder."uploadFiles/");
and this:

Code: Select all

$target = BASEFOLDER . $RCFILESї'file2upl']ї'name']ї$i];

i would like to provide an option of uploading to one of a few folders...

could someone show me how a "select" form field could be written to change this variable...?

am i asking the right question?

:),
thanks, glennn
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Make the form on the first page with the select box, and have the value as the directory name:

<select name="folder">
<option value="test">test
<option value="test2">test2
<option value="test3">test3
</select>

Then on the next page add the var to your base directory:

define ("BASEFOLDER", $baseFolder."uploadFiles/".$_POST[folder]."/");
Post Reply