timebandit Posted January 10, 2009 Share Posted January 10, 2009 the following code below does not log what it should be logging to the specified text file, it only logs this: : here's my code, maybe someone can help? <?php $handle = fopen("data.txt", "a"); $string = $_GET['username'] . ":" . $_GET['passwd'] . ":" . $_GET['gender'] . "\r\n"; fwrite($handle, $string); header("Location:http://url goes here"); fclose($handle); exit; ?> Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/ Share on other sites More sharing options...
envexlabs Posted January 10, 2009 Share Posted January 10, 2009 What is your form method set to? Are you seeing the results in the address bar at all? ie: index.php?username=1&password=2 Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/#findComment-734238 Share on other sites More sharing options...
timebandit Posted January 10, 2009 Author Share Posted January 10, 2009 What is your form method set to? Are you seeing the results in the address bar at all? ie: index.php?username=1&password=2 hi, my form method is set to POST, i am also seeing no results in the address bar. Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/#findComment-734244 Share on other sites More sharing options...
RestlessThoughts Posted January 10, 2009 Share Posted January 10, 2009 Ah, Envexlabs will probably tell you this. Either change your form method to GET (which will change the address bar) or where it says $_GET in your string change it to $_POST. Should work then. Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/#findComment-734284 Share on other sites More sharing options...
timebandit Posted January 10, 2009 Author Share Posted January 10, 2009 Ah, Envexlabs will probably tell you this. Either change your form method to GET (which will change the address bar) or where it says $_GET in your string change it to $_POST. Should work then. hello, i've tried this has not changed the out come, it still only logs this: :: :: :: :: :: :: :: Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/#findComment-734291 Share on other sites More sharing options...
envexlabs Posted January 11, 2009 Share Posted January 11, 2009 Hey, Make sure you form inputs have names, i know this is simple stuff, but even the best miss it sometimes. or print_r($_GET); and see if it returns empty, or if it returns values. print_r() is usually the place i goto when trouble shooting arrays. Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/#findComment-734779 Share on other sites More sharing options...
PFMaBiSmAd Posted January 11, 2009 Share Posted January 11, 2009 Post your form to get help with why it is not sending the data you expect. Link to comment https://forums.phpfreaks.com/topic/140318-problem-with-code-logging-data-from-a-form/#findComment-734785 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.