My form doesn't move

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BenKen
    New Member
    • Jun 2009
    • 8

    #1

    My form doesn't move

    Hello guys please when i click submit on my form,it doesnt move at all not even a failed message comes up,nothing happens.This is my code below please help.Cheers


    Code:
    <?php
       $to = $_POST['to'];
       $from = $_POST['from'];
       $bcc = $_POST['bcc'];
       $subject = $_POST['subject'];
       $message = $_POST['message'];
    
       $headers .= "To: $to \r\n";
       $headers = "From: $from\r\n";
       $headers .= "Bcc: $bcc \r\n";
       $headers .= "Reply-to: $from\r\n";
    
       // send mail
       ini_set("sendmail_from", "user@domain.com" );
       if (mail($to,$subject,$message,$headers)){
         echo "Message sent successfully";
       }else{
         echo "Error: Sending your message failed";
       }
    
    ?>
    Last edited by Markus; Sep 15 '09, 09:48 AM. Reason: Added [code] tags.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    If your form doesn't even submit, then this is not a PHP problem. You'll have to explain a little more, provide the HTML markup, etc.

    Also, use [code] tags when posting code.

    Mark.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      line 9 causes line 8 to be dropped, you have no email address to send to.

      Comment

      • BenKen
        New Member
        • Jun 2009
        • 8

        #4
        Pls what do you mean by line 9 affects 8?

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by BenKen
          Pls what do you mean by line 9 affects 8?
          You are not concatenating the string, like you are on line #8. Line #9 effectively overwrites the string that was created at line #8.

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            There is no fullstop before the equals sign on line 9. Basically you are resetting your $headers variable.

            Originally posted by Markus
            You are not concatenating the string, like you are on line #8. Line #9 effectively overwrites the string that was created at line #8.
            Last edited by TheServant; Sep 21 '09, 01:05 AM. Reason: Markus beat me by seconds :(

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Originally posted by TheServant
              There is no fullstop before the equals sign on line 9. Basically you are resetting your $headers variable.
              We must've only been seconds apart ;D

              Comment

              Working...