patk24 Posted September 23, 2006 Share Posted September 23, 2006 OK..im tryin to have this from saved to a txt file and heres the code: [code][<form method='post'> Name: <input name='Name' type='text' /><br /> Email: <input name='Email' type='text' /><br /> Comment: <input name='Comment' type='text' /><br /> <input type='submit' name='Confirm' /></form><?phpif(isset($_POST)){ $filename = "subscribers.txt"; $content = $_POST['Name']."\n".$_POST['Email']."\n".$_POST['Comment']."\n\n\n"; $fp = fopen($filename, "a"); $fw = fwrite( $fp, $content ); fclose( $fp ); if(!$fw) echo "Couldn't write the entry."; else echo "Successfully wrote to the file.";}?>[/code]I get an "undifened index" error for 'Name' 'Comment' and 'Email'How can i fix this? BTW it says that its been successfully wrote to a file i just get that error and it says its on line 273 and that line is this one:[code]$content = $_POST['Name']."\n".$_POST['Email']."\n".$_POST['Comment']."\n\n\n";[/code]can anyone help? Link to comment https://forums.phpfreaks.com/topic/21797-error-with-php/ Share on other sites More sharing options...
patk24 Posted September 23, 2006 Author Share Posted September 23, 2006 any help?? Link to comment https://forums.phpfreaks.com/topic/21797-error-with-php/#findComment-97374 Share on other sites More sharing options...
mb81 Posted September 23, 2006 Share Posted September 23, 2006 The first problem you have is the way you are checking for $_POST variables. $_POST is always set, although sometimes it is empty. Change isset($_POST) to sizeof($_POST)>0, then give it a shot. Link to comment https://forums.phpfreaks.com/topic/21797-error-with-php/#findComment-97378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.