triaje Posted May 11, 2007 Share Posted May 11, 2007 hey everybody I have a problem!!! see i have a guestbook(a html file and a php file) that produces a txt file. the thing is i use this guestbook as a journal and I call the txt content from a flash thats where my problem began. this is the php file, my html form call <?php $name = $_POST['Name']; $comments = $_POST['Comments']; $timedate = date("M d, Y (g:i a)", time() + 7200); if ($name == "" or $comments == "") { echo "One or more required fields were not completed. Please go back and try again. <br /><br />"; } else { $oldinfo = file_get_contents("bookdata.txt"); $guestbookdata = fopen("bookdata.txt", "w+"); fwrite($guestbookdata, "$name - $timedate \n"); fwrite($guestbookdata, "Comments: $comments \n \n"); fwrite($guestbookdata, "$oldinfo"); fclose($guestbookdata); readfile("bookdata.txt"); } ?> to get the flash display the data.txt I have to add a variable at the begining of the txt file so I added a line at the php script that writes a "var=" at the beginnin of each entry but then i found var= in each entry so is not quite neat. <?php $name = $_POST['Name']; $comments = $_POST['Comments']; $timedate = date("M d, Y (g:i a)", time() + 7200); if ($name == "" or $comments == "") { echo "One or more required fields were not completed. Please go back and try again. <br /><br />"; } else { $oldinfo = file_get_contents("bookdata.txt"); $guestbookdata = fopen("bookdata.txt", "w+"); fwrite($guestbookdata, "Entry= "); fwrite($guestbookdata, "$name - $timedate \n"); fwrite($guestbookdata, "Comments: $comments \n \n"); fwrite($guestbookdata, "$oldinfo"); fclose($guestbookdata); readfile("bookdata.txt"); } ?> my question is how do i disapear the xml flash variables first before copying the file(see script) so i dont get to see "Entry=" at the beginning of the each. i just needed at the begining of the file apreciate help Quote Link to comment https://forums.phpfreaks.com/topic/50935-problem-with-small-guestbook-script/ 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.