awert Posted July 19, 2007 Share Posted July 19, 2007 Hey im making a site which allows the user to type in their e-mail address and send it to my "emails.txt" file. Its not really working though...It seems like everything is right but it doesnt add it: Heres part of the code for the site: method=get then action=next.php" name="theForm" id="theForm"> and this is the whole next.php: <?php header("my url "); $handle = fopen("emails.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; ?> Im pretty new to php so if you could help it would be great Thanks in advance Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 19, 2007 Share Posted July 19, 2007 you think about mysql? its easier and faster Quote Link to comment Share on other sites More sharing options...
awert Posted July 19, 2007 Author Share Posted July 19, 2007 nah i really just need to get this done...unless theres a tutorials about doing this with mysql? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 19, 2007 Share Posted July 19, 2007 this should do for flat file <?php if(!empty($_GET)){ $handle = fopen("emails.txt", "a"); foreach($_GET as $key => $value) { $tempstring = $key."=".$value."\n"; fwrite($handle,$tempstring); } fclose($handle); } ?> I think you are bloating the data you are putting in sine the key is always the same, should just be $tempstring = $value."\n"; but its your method Quote Link to comment 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.