morfin91 Posted May 26, 2009 Share Posted May 26, 2009 im traing to get my code to work but it don't work to 100% the code create a folder and sall create a .html file with in it. the problem is that the file are not created in the folder. i need help to fix it. one other problem is that the file dont get right name it shood get the name from $pass but it get's acc_namn$pass? my code is. <?php print_r ($_POST); $acc_namn = $_POST['accNamn']; $pass = $_POST['pass']; $at = "C:/www/Poj/acc/"; $var = "C:/www/Poj/acc/"."acc_namn"; $folder = $acc_namn; if ( !file_exists($folder)){ mkdir($folder, 770); } $file = $var.$pass.'.html'; // Open the file to get existing content $current = file_get_contents($file); // Append a new person to the file $current .= "John Smith\n"; // Write the contents back to the file file_put_contents($file, $current); ?> Quote Link to comment https://forums.phpfreaks.com/topic/159745-need-code-fix/ Share on other sites More sharing options...
Axeia Posted May 26, 2009 Share Posted May 26, 2009 Try echo'ing out $current, I suspect you're missing a couple of "/". Quote Link to comment https://forums.phpfreaks.com/topic/159745-need-code-fix/#findComment-842579 Share on other sites More sharing options...
iarp Posted May 26, 2009 Share Posted May 26, 2009 $var = "C:/www/Poj/acc/"."acc_namn"; Look like your trying to append acc_namn from a line or two above it. Should've been $var = "C:/www/Poj/acc/" . $acc_namn; Quote Link to comment https://forums.phpfreaks.com/topic/159745-need-code-fix/#findComment-842587 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.