Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorSpittelau
    • CommentTimeOct 10th 2007
     permalink
    I am having some trouble getting a PHP form to work properly on my website. Below is the mark-up, which can also be found on my website at http://www.shakethedisease.net/contact/ . The script was working for a few months, but now the webpage states "Notice: Undefined index: submit in /home/shakethe/public_html/contact.php on line 1" and "Notice: Undefined variable: mail in /home/shakethe/public_html/contact.php on line 34." Thanks for any input.

    <?If ($_POST['submit']){
    $from=$_POST['from'];
    $body = wordwrap ($_POST['body'], 70); //this is because the mail function cannot have a line with more than 70 chars
    $header = "From: $from <sitemailer@shakethedisease.net>";
    $mail = mail('robert@shakethedisease.net', $_POST['subject'], $body, $header);
    }?>


    <?If ($mail) echo "Message sent."; ?>
    <form action="<?=$PHP_SELF?><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />" method="POST">
    Name:<br /><input type="text" name="from" /><br />
    E-mail:<br /><input type="text" name="subject" /><br />
    Comments:<br /><textarea name="body"></textarea><br />
    <input type="image" src="images/send.jpg?phpMyAdmin=4594f30712f4fabaff6997416810f3f2" name="submit" value="Send" />
    <input type="image" src="images/reset.jpg?phpMyAdmin=4594f30712f4fabaff6997416810f3f2" name="reset" value="Reset" />
    </form>
    • CommentAuthordavist11
    • CommentTimeOct 10th 2007
     permalink
    Change <?If ($mail) echo "Message sent."; ?>
    to
    <?If (isset($mail)) echo "Message sent."; ?>
    Thankful People: Spittelau
    • CommentAuthorSpittelau
    • CommentTimeOct 10th 2007
     permalink
    It worked, thanks!
    • CommentAuthorSpittelau
    • CommentTimeOct 10th 2007
     permalink
    Now none of the messages are reaching my inbox. Is this in any way associated with $header = "From: $from <sitemailer@shakethedisease.net>"; ?
    • CommentAuthordavist11
    • CommentTimeOct 10th 2007
     permalink
    What do you mean they aren't reaching your inbox? Are they going to your spam folder? Are you getting an error message? Has anything changed? You said it used to work before.
    • CommentAuthorSpittelau
    • CommentTimeOct 11th 2007
     permalink
    Sorry, I failed to mention that my email server is hosted through Gmail. In the past I had used the email service provided by my host. Nothing is being dumped into my spam folder and there aren't any error messages.
    •  
      CommentAuthorjernigani
    • CommentTimeOct 11th 2007
     permalink
    Have you tried talking to your hosting provider? They might have some restrictions on what you can do with the mail function.

    Also, do you know if you are passing the values into the mail function?

    try just sending an email like so, (maybe even try using a different email address, one that you know works)
    <?
    $mail = mail("robert@shakethedisease.net", "Here is my subject", "Here is my body", "sitemailer@shakethedisease.net");

    if($mail){
    echo 'It totally worked';
    }else{
    echo 'Didn't work';
    }
    ?>

    If the above code doesn't work, than I would just try talking to your hosting provider. They usually are quite helpful. :D
    • CommentAuthorSpittelau
    • CommentTimeOct 11th 2007
     permalink
    I think that since my host no longer manages my email server I can no longer use form mail. I guess the question is do I stick with Gmail and replace the form with something else or revert back to my host's email service.
  1.  permalink
    Pertinent to the topic, if not the question: I just built a few test forms via phpforms.org and so far so good, it's a nice little tool.
    • CommentAuthorSpittelau
    • CommentTimeOct 11th 2007
     permalink
    For now I'll just remove the form.
    • CommentAuthorSpittelau
    • CommentTimeOct 11th 2007
     permalink
    After some further thought I decided to switch back to my host's server. So now the form works with zero problems. Thanks to everyone for their help!
    • CommentAuthorvarland
    • CommentTimeOct 12th 2007
     permalink

    You may be able to go back to Gmail if you prefer that, and create a subdomain through your host that does nothing but manage your email for you, since that email wouldn't be managed by Gmail.

Add your comments
    Username Password
  • Format comments as (Help)