Jump to content

create dir


crazy8

Recommended Posts

So lets say I have a drop down menu in a form, and I will have a folder already made for each of the possible selections in the drop down menu. How could I set this up to have the persons account go into a folder that they chose from the drop down?

Ok to explain this more clear. I have an account system I am setting up, which consist of 3 forms. The first form has a drop down whos options are "clubs", "bars", "resturants", and "coffee_shops". So lets say someone is setting up an account for a resturant of theirs. So they pic "resturant" from the drop down. How can i set this up so that a personalized folder form them will go into the resturant folder?

 

Thank you guys for the help

Link to comment
https://forums.phpfreaks.com/topic/78455-create-dir/#findComment-397019
Share on other sites

So lets say I have a drop down menu in a form, and I will have a folder already made for each of the possible selections in the drop down menu. How could I set this up to have the persons account go into a folder that they chose from the drop down?

Ok to explain this more clear. I have an account system I am setting up, which consist of 3 forms. The first form has a drop down whos options are "clubs", "bars", "resturants", and "coffee_shops". So lets say someone is setting up an account for a resturant of theirs. So they pic "resturant" from the drop down. How can i set this up so that a personalized folder form them will go into the resturant folder?

 

Thank you guys for the help

 

<?php
// Lets start
include("you connection to your database");
// Get the name of the folder the user has chose
$account_dir = $_POST['drop_down_menu'];

// Now the name of the user
$username = $_POST['username'];

if($account_dir == "clubs"){ // Check if the user has selected clubs

mkdir($account_dir."/".$username,0700); // create the directory in the clubs section, and add his username

mysql_query("INSERT INTO user_accounts (username,dir) VALUES ('$username','$account_dir')") or die(mysql_error()); // if you want to identify the user later on, you need to know his directory he registered under

}
elseif($account_dir == "coffee_shop"){

mkdir($account_dir."/".$username,0700); 

mysql_query("INSERT INTO user_accounts (username,dir) VALUES ('$username','$account_dir')")  or die(mysql_error());

}
elseif($account_dir == "resturants"){

mkdir($account_dir."/".$username,0700); 

mysql_query("INSERT INTO user_accounts (username,dir) VALUES ('$username','$account_dir')")  or die(mysql_error());

}

?>



Link to comment
https://forums.phpfreaks.com/topic/78455-create-dir/#findComment-397025
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.