Appending to Text file with php
Posted: Sun Sep 05, 2004 1:27 pm
feyd | Please use
I know that this isn't right to separate the fields by commas, but I get this error when I submit from the form:
By the way, I have set the permissions for the directory for full read/write. Thanks very much for the help, everyone.
feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi all,
I'm trying to make a simple database using a text file that gets its values from a form. I want to set up the script so that each item is separated by a comma. Then the data from each new submission from the form gets written to the next line. Here's what I have so far:Code: Select all
<?php
$fp = fopen("submission.txt","a");
$content = "Band Name:".$_POST["band_name"]." Contact:".$_POST["contact"]." Email:".$_POST["email"]." Home Phone:".$_POST["home_phone"]." Cell Phone:".$_POST["cell_phone"]." Contact:".$_POST["city"]." Contact:".$_POST["state"]." Contact:".$_POST["link"]." Contact:".$_POST["bio"]."\r\n";
fwrite($fp,$content);
fclose($fp);
?>Code: Select all
Warning: fopen("submission.txt", "a") - Permission denied in /home/httpd/vhosts/arxposure.com/httpdocs/db/submission2.php on line 2
Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/httpd/vhosts/arxposure.com/httpdocs/db/submission2.php on line 5
Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/httpd/vhosts/arxposure.com/httpdocs/db/submission2.php on line 6feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]