Jump to content

Save Field Contents Script


sombra84

Recommended Posts

Hello All,

 

I have searched and read and read.  I have a page, and when submitted i want it to submit the content of the field to a .txt file.

 

I have my page running and it POSTS to saveme.php as such:

 

<form method="POST" action="http://192.168.1.109/saveme.php" id="save_data" onsubmit="return"

 

And my saveme.php is this:

 

<?php
header("Location: http://192.168.1.109 ");
$handle =

fopen("saveddata.txt", "a");
foreach($_GET as

$variable => $value) {
fwrite($handle,

$variable);
fwrite($handle, "=");

fwrite($handle, $value);
fwrite($handle,

"\r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>

 

This does not work.  It submits like it should when I hit the save button on my website however saveddata.txt does not ever get any contents.  I checked to make sure php is running fine on my webserver.

 

I am okay with HTML but new to PHP.

 

All i want to do is save the contents of the text boxes to a file when I hit submit.  I am using this so that agents can submit data to me and this is the easiest and most practical way.

 

Anybody see my mistake?

Link to comment
https://forums.phpfreaks.com/topic/242100-save-field-contents-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.