Jump to content

[SOLVED] Help with simple fwrite() script


quarantine

Recommended Posts

I just started learning php and I am having trouble with this script, I intend for the script to write a users input and name into a text file on my server, when I run the script I can't get it to write anything, and it doesn't give me any errors. Any suggestions?

 

<?php 

//retrieve user input

$_POST['body'] = $body;

$_POST['name'] = $name;

//open and close the guest book file for writing

$guestbook = "guestbook.txt";

$fh = fopen($guestbook, 'a') or die("can't open file");

fwrite($fh, $name, 'says', $body);

fclose($fh);

?>

 

Thanks for taking the time to read!

Link to comment
https://forums.phpfreaks.com/topic/154547-solved-help-with-simple-fwrite-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.