Results 1 to 4 of 4
Thread: a bit of php help
-
04-07-2004, 06:46 PM #1Newbie
- Join Date
- Nov 2003
- Posts
- 22
a bit of php help
I was wondering if someone could point me in the right direction here, Basically i want a web form that would write the contents to a file. Every time the form is submitted, that contents of the form would replace what was currently in the file.
I'm assuming I'll be using fwrite but if someone could point me where to look for more info I'd appriciate it.
Thanks, Pam
-
04-07-2004, 07:07 PM #2Disabled
- Join Date
- Dec 2002
- Location
- chica go go
- Posts
- 11,876
you could try...
PHP Code:<?PHP
$data = $_POST["data"];
system('rm -rf datafile'); system('touch datafile'); system('echo "$data" > datafile');
?>
Code:<textarea name="data"></textarea>
Make sure to have permissions set on datafile set to 777.
-
04-07-2004, 07:52 PM #3Retired Moderator
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 4,721
PHP Code:if($submit) {
$fp = fopen("file.txt", "w");
fputs($fp, "$_POST['data']");
fclose($fp);
echo "Form Submitted, thanks!";
}
$data = "".$_POST['input1']."<br>".$_POST['input2']."";
and
fputs($fp, "$data");
or whateverLast edited by Ash; 04-07-2004 at 07:55 PM.
Hyperconfused (™)
-
04-08-2004, 02:34 AM #4Designer
- Join Date
- Apr 2002
- Posts
- 2,195
Loon's code is what I would use as well. Not sure about the other.