Jump to content

problem with small guestbook script


triaje

Recommended Posts

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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.