Jump to content

Error with PHP


patk24

Recommended Posts

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>
<?php

if(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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.