zipppy Posted September 4, 2008 Share Posted September 4, 2008 Why does this simple snippet not print the info to .txt file pluged in by the user? <?php $f=fopen("text.txt","a"); fwrite($f,"****************************************\r\n\r\n"); fwrite($f," Name: $name\r\n"); fwrite($f," Email: $email\r\n\r\n"); fclose($f); ?> It prints to text.txt on the server Name: Email: but no input data. Any good help appreciated greatly. zippy Link to comment https://forums.phpfreaks.com/topic/122760-simple-solution-for-you-guys-i-am-sure/ Share on other sites More sharing options...
LooieENG Posted September 4, 2008 Share Posted September 4, 2008 Because you haven't defined $name or $email Did you mean to do this? <?php $name = $_POST['name']; // Name form form $email = $_POST['email']; // Email from form $f=fopen("text.txt","a"); fwrite($f,"****************************************\r\n\r\n"); fwrite($f," Name: $name\r\n"); fwrite($f," Email: $email\r\n\r\n"); fclose($f); ?> Link to comment https://forums.phpfreaks.com/topic/122760-simple-solution-for-you-guys-i-am-sure/#findComment-633889 Share on other sites More sharing options...
zipppy Posted September 4, 2008 Author Share Posted September 4, 2008 yep, that was it, greatly appreciated. Tim Link to comment https://forums.phpfreaks.com/topic/122760-simple-solution-for-you-guys-i-am-sure/#findComment-633918 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.