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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.