How do u write to a text file?
Posted: Tue May 28, 2002 8:33 am
Dear Helper:
I was wondering if anyone could help me with a little problem I have. I am a Gr. 12 student at Holy Cross Secondary and I'm doing a school project... I've been working on this project for a while. I need a form to have a person input scores for the games which are played at our school. This I've already managed to have finished. My biggest problem is that I need the information inputted by user, stored in the variables to be outputted onto a file eg. Sport.html or Sport.txt. I've seen the include function used but im not sure how to write to a file. The file must also keep all it's old entries and evertime the new information is entered it should go at the top. I hope I've made myself clear enough about this problem. If not I'm be more then happy to clarify.
Anyways if anyone could please help I'd be eternally greatful!
Thanks for your time
Jim
P.S. This is the code where it writes to the sport.html or sport.txt file.
<?if ($user == "user" and $pass == "pass" and
$team == true and
$HCS == true and
$OTS == true and
$information == true)
{
CODE TO WRITE TO TEXT FILE GOES HERE
?>
<?
}else{
?>
You have either entered the incorrect login/password, or have not filled in one of the form fields.
<?
}
?>
I was wondering if anyone could help me with a little problem I have. I am a Gr. 12 student at Holy Cross Secondary and I'm doing a school project... I've been working on this project for a while. I need a form to have a person input scores for the games which are played at our school. This I've already managed to have finished. My biggest problem is that I need the information inputted by user, stored in the variables to be outputted onto a file eg. Sport.html or Sport.txt. I've seen the include function used but im not sure how to write to a file. The file must also keep all it's old entries and evertime the new information is entered it should go at the top. I hope I've made myself clear enough about this problem. If not I'm be more then happy to clarify.
Anyways if anyone could please help I'd be eternally greatful!
Thanks for your time
Jim
P.S. This is the code where it writes to the sport.html or sport.txt file.
<?if ($user == "user" and $pass == "pass" and
$team == true and
$HCS == true and
$OTS == true and
$information == true)
{
CODE TO WRITE TO TEXT FILE GOES HERE
?>
<?
}else{
?>
You have either entered the incorrect login/password, or have not filled in one of the form fields.
<?
}
?>