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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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