Wolverine68 Posted May 11, 2011 Share Posted May 11, 2011 Just trying to create a simple form that will let you enter a message that will get written to a text file. Code for SetMessage.php: <?php if($_SERVER['REQUEST_METHOD'] != 'POST') { ?> <form method="POST" action="setmessage.php" name="setmessage"> <p>Message to Display:<Input type="text" name="message" size="50"></p> <p><input type="submit" value="Submit" name="submit"></p> </form> <?php } else { //Writes the contents of the message to a file echo file_put_contents('message.txt', $_POST['message']); } ?> When submitting, I get the error "Call to undefined function: file_put_contents() on line 16" Link to comment https://forums.phpfreaks.com/topic/236160-trying-to-write-data-to-a-file-using-file_put_contents/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 12, 2011 Share Posted May 12, 2011 From the php.net documentation - file_put_contents (PHP 5) If you are still using php4, be aware that the end of life of php4 was over 4 years ago and everyone should have already upgraded to the latest php5 version. Link to comment https://forums.phpfreaks.com/topic/236160-trying-to-write-data-to-a-file-using-file_put_contents/#findComment-1214206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.