ball420 Posted October 8, 2007 Share Posted October 8, 2007 i got it to create and write a txt file but now i'm trying to get it to create a new directory then write the file. thanks for all the help <?php $newDirName = ["clientsName"] $_POST["repsName"] . $_POST["clientsName"]. $_POST["clientsPhone"]. $_POST["clientsUrl"]. $_POST["shortDescroption"]. $_POST["longDescription"]; if(is_dir("./files")) mkdir("./files/"$newDirName, 0755); $mode = file_exists('user_input.txt')?'a':'w'; // append if file exists otherwise create it $fp = fopen('user_input.txt',$mode); // open file fwrite($fp,print_r($_POST,true)."\r\n"); // dump the contents of the $_POST array to the file fclose($fp); ?> Quote Link to comment https://forums.phpfreaks.com/topic/72346-create-dir-then-writing-txt-file/ Share on other sites More sharing options...
ball420 Posted October 8, 2007 Author Share Posted October 8, 2007 updated code <?php $newDirName = $_GET["clientsName"] $_POST["repsName"] . $_POST["clientsName"]. $_POST["clientsPhone"]. $_POST["clientsUrl"]. $_POST["shortDescroption"]. $_POST["longDescription"]; if(is_dir("./files")) mkdir("./files/"$newDirName, 0755); $mode = file_exists('user_input.txt')?'a':'w'; // append if file exists otherwise create it $fp = fopen('user_input.txt',$mode); // open file fwrite($fp,print_r($_POST,true)."\r\n"); // dump the contents of the $_POST array to the file fclose($fp); ?> Quote Link to comment https://forums.phpfreaks.com/topic/72346-create-dir-then-writing-txt-file/#findComment-364839 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.