Code: Select all
<?php
$project_dir = $_POST['project_dir'];
function make_default_dirs() {
global $project_dir;
//create dirs
mkdir("$project_dir/$sectiondir1/", 0755);
chmod("$project_dir/$sectiondir1/", 0777);
mkdir("$project_dir/$sectiondir2/", 0755);
chmod("$project_dir/$sectiondir2/", 0777);
mkdir("$project_dir/$sectiondir3/", 0755);
chmod("$project_dir/$sectiondir3/", 0777);
mkdir("$project_dir/$sectiondir4/", 0755);
chmod("$project_dir/$sectiondir4/", 0777);
mkdir("$project_dir/$sectiondir5/", 0755);
chmod("$project_dir/$sectiondir5/", 0777);
mkdir("$project_dir/$sectiondir6/", 0755);
chmod("$project_dir/$sectiondir6/", 0777);
mkdir("$project_dir/$sectiondir7/", 0755);
chmod("$project_dir/$sectiondir7/", 0777);
}
if (!empty($_POST['project_dir']) ) {
//check if main dir is available then makes if if it is not.
mkdir("$project_dir/", 0755);
chmod("$project_dir/", 0777);
} else {
print "Project photos'' directory not created";
}
if (is_dir("$project_dir/") && !empty($_POST['project_dir']) ) {
make_default_dirs();//execute function
} else {
print "Please Enter a project id.";
}
?>Now I would like to use a form select to specify which sectiondir it goes in but I dont want to have to use the hardcoded thing that I had above. 1 of the 7 form selects is as follows:
Code: Select all
<select size="1" name="sectiondir1">
<OPTION>-----Section-----
<OPTION VALUE="electricalpanel">Electrical Panel
<OPTION VALUE="contactor">Contactor Box
<OPTION VALUE="elements">Elements
<OPTION VALUE="steamtablewp">Steam Table Water Pans
<OPTION VALUE="steamcabwp">Steam Cabinet Water Pans
<OPTION VALUE="steamcabd">Steam Cabinet Doors
<OPTION VALUE="steamcabmod">Steam Cabinet Module
<OPTION VALUE="steamcabhe">Steam Cabinet Hood/Exhaust
<OPTION VALUE="producebin">Produce Bin
<OPTION VALUE="reachfridge">Reach in Refridgerator
<OPTION VALUE="panfillsys">Water Pan Water Fill System
<OPTION VALUE="steamtablecont">Steam Table Controller
<OPTION VALUE="tacowarmunit">Taco Warmer Unit/Taco Tower
<OPTION VALUE="cheesemelter">Round Up Cheese Melters
<OPTION VALUE="integrity">Structural Integrity
<OPTION VALUE="misc">Miscellaneous
<OPTION VALUE="summary">Summary/Recommendation
</select>Thanks a lot,
-Steve