Minimeallolla Posted November 11, 2010 Share Posted November 11, 2010 ok so now that the submit button is clicked, it stores $content into the file that we wanted. thats all good and everytihng, now i want to echo that files content. and replace the whole content with the new $content everytime, if you know what i mean..? if (isset($_POST['submit'])) { $firstname = ($_POST['firstname']); $lastname = ($_POST['lastname']); include ("cookieusername.php"); $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) $filename = "/home/bob/public_html/mysite/profiles/profileinfo/$username.info.php" or exit("Unable to open file!"); $handle = fopen($filename, 'a+')or die; $content = "$firstname"; fwrite($handle, $content)or die; fclose($handle); } Link to comment https://forums.phpfreaks.com/topic/218381-help-how-would-i-do-this-2/ Share on other sites More sharing options...
ManiacDan Posted November 11, 2010 Share Posted November 11, 2010 To echo content: echo $content; To overwrite a file instead of appending, change the 'a+' to 'w' -Dan Link to comment https://forums.phpfreaks.com/topic/218381-help-how-would-i-do-this-2/#findComment-1133117 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.