writeing a txt file with php and html problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
andrew1234
Forum Newbie
Posts: 1
Joined: Tue Feb 04, 2003 5:16 am
Location: southafrica

writeing a txt file with php and html problem

Post by andrew1234 »

I can do the following in flash but but HML

i want to write a .txt file from a form

The HTML form is being pointed to the php file "htwrite.php"
and the text area variable "comments"
matched the variable in the php script "$comments"

why does the not work???????

i get a server error

oh and the CHMOD has been changed to 777( access to all permisions )

below are my scripts

thanks

Andrew
___________________________________________________________


<html>

<head>

<title>New Page 1</title>
</head>

<body>

<form method="POST" name="htwrite.php">
<p><textarea rows="11" name="comments" cols="20"></textarea></p>
<p>&nbsp;</p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>
___________________________________________________________

<?php
//saves the email text files
$filename = "writeto.txt";
$fd = fopen ($filename, "w");

fputs ($fd, $comments);

fclose ($fd);



?>
<html>

done
</html>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you read this:
viewtopic.php?t=511

Mac
Post Reply