sombra84 Posted July 16, 2011 Share Posted July 16, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/242100-save-field-contents-script/ Share on other sites More sharing options...
trq Posted July 16, 2011 Share Posted July 16, 2011 Your form uses the method POST yet you are looking for data within the $_GET array. Quote Link to comment https://forums.phpfreaks.com/topic/242100-save-field-contents-script/#findComment-1243320 Share on other sites More sharing options...
AbraCadaver Posted July 16, 2011 Share Posted July 16, 2011 Your form uses the method POST yet you are looking for data within the $_GET array. Also, the very first line of the script is a redirect! Quote Link to comment https://forums.phpfreaks.com/topic/242100-save-field-contents-script/#findComment-1243471 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.