You can use the code below and see if that works. You will have to modify it to fit your server. I did not test it, but it should get you a step closer to what you are trying to do.
Be sure that the folder that you are creating another folder in is set to 777 before running the script.
<?
include "dbconnection.php";
$resourcefolder = "/Your/Server/Path/To/Folder/With/Files/You/Want/To/Copy/";
$filestocopy = array;
$filestocopy[0] = "contact.php";
$filestocopy[1] = "sample.php";
$foldername = "test";
mkdir($foldername, 0777);
chmod($foldername, 777);
$sql=mysql_query("INSERT INTO folders (foldername) VALUES ('$foldername'");
foreach($filestocopy as $ftc){
$frompath = $resourcefolder.$ftc;
$topath = $resourcefolder.$foldername."/".$ftc
if(copy($frompath, $topath)){
echo "Directory Created and files copied!";
} else {
echo "An error occured!";
}
?>
enjoy!