JREAM Posted September 8, 2008 Share Posted September 8, 2008 If anyone is able to help please do! I had it working but I was trying to change some things and it went bad, no E_ALL errors but it won't write: <?php $dir = "data/blocks/"; function showblocks() { global $dir; print '<div class="tabber">'; foreach (glob ("$dir{*.php}", GLOB_BRACE) as $blocks) { $frmt = str_replace('.php', '', basename($blocks)); block($frmt, $frmt); } echo '</div>'; } function block($name, $title){ global $dir; if (isset($_POST['$name'])) { $dir = "data/blocks/" . $name; $fp = fopen ($filename, "w"); if ($fp) { fwrite ($fp, $text); fclose ($fp); } } print ' <div class="tabbertab"> <h2>' . $title . '</h2>' . $name . '<br /> <form name="' . $name . '" method="post" action="?action=showblocks"> <textarea name="' . $name . '" cols="90" rows="10"> '; include($dir . $name . '.php'); print '</textarea> <br /> <input class="b" type="submit" name="sub" value="Save Changes" /> </form> </div>'; } ?> Link to comment https://forums.phpfreaks.com/topic/123250-fwrite-i-messed-this-up-and-cant-figure-out-what-i-did/ Share on other sites More sharing options...
GingerRobot Posted September 8, 2008 Share Posted September 8, 2008 Well, you're writing with this line: fwrite ($fp, $text); However, $text is undefined. Therefore, nothing is getting written to the file. I can't help you further without seeing more of your code. I suspect that either you need to pass $text to the function or that $text is supposed to be $name or $title. Link to comment https://forums.phpfreaks.com/topic/123250-fwrite-i-messed-this-up-and-cant-figure-out-what-i-did/#findComment-636494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.