Writing to a file
Posted: Tue Apr 26, 2005 10:31 am
Hello, on my site i have a feedback page feedback.htm
and the forms action points to reply.php where i write out what the person has put.
I can also get it to write to a text file, but it goes along in a line,
i am not sure how to get it to write to a text file line by line
Example:
Name: Andy
Age: -20
at the Momement i am getting
Name: Andy Age: - 20 ect....
Here is the code in my reply.php
Thanks for any help
Andy
and the forms action points to reply.php where i write out what the person has put.
I can also get it to write to a text file, but it goes along in a line,
i am not sure how to get it to write to a text file line by line
Example:
Name: Andy
Age: -20
at the Momement i am getting
Name: Andy Age: - 20 ect....
Here is the code in my reply.php
Code: Select all
<?php
$name = $_POSTї'name'];
$age = $_POSTї'age'];
$member = $_POSTї'member'];
$reserve = $_POSTї'reserve'];
$useful = $_POSTї'useful'];
$information = $_POSTї'information'];
$comments = $_POSTї'comments'];
echo "e;<b>Name: </b>"e;.$name; ?><br><?
echo "e;<b>Age: </b>"e;.$age; ?><br><?
echo "e;<b>Current Member? </b>"e;.$member; ?><br><?
echo "e;<b>Have you ever reserved anything? </b>"e;.$reserve; ?><br><?
echo "e;<b>Do you find this site useful? </b>"e;.$useful; ?><br><?
echo "e;<b>Do you think the information is up-to-date? </b>"e;.$information; ?><br><?
echo "e;<b>Any Comments? </b>"e;.$comments;
$SEPARATOR = "e;::"e;;
$filename = 'feedback.txt';
$details = "e;Name: $name"e;.$SEPARATOR.
"e;Age: $age"e;.$SEPARATOR.
"e;Current Member? $member"e;.$SEPARATOR.
"e;Reserved Anything? $reserve"e;.$SEPARATOR.
"e;Site Useful? $useful"e;.$SEPARATOR.
"e;Up-to-date Infor? $information"e;.$SEPARATOR.
"e;Comments? $comments"e;.$SEPARATOR;
$file = fopen($filename,"e;a"e;);
fputs ($file, $details);
fclose($file);
?>Andy