Help! Contact form not working!

Discussion in 'HTML & Website Design' started by taktikz, Oct 29, 2010.

  1. #1
    My contact form isn't sending messages although it says it is.
    Here is the website: spinalcordinjuryattorney.co

    Would really appreciate anyone's help.

    Thanks!
     
    taktikz, Oct 29, 2010 IP
  2. hirensoni913

    hirensoni913 Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    for this you will have to provide a code which you are using to send email. without that how can we figure out the problem?
     
    hirensoni913, Oct 29, 2010 IP
  3. taktikz

    taktikz Active Member

    Messages:
    692
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #3
    <?php
    
    if ($_GET["email"] == "attempt"){
      $to='admin@namesale.net';
      $messageSubject='Message from ...';
      $confirmationSubject='Confirmation of your emai message to ...';
      $confirmationBody="Thank you for contacting us. Your case information has been sent and we will be in touch with you soon.\n\n";
      $email='';
      $body='';
      $displayForm=true;
      $phone = $_POST['phone'];
    	$name = $_POST['name'];
     
     	
       if ($_POST){
        $email=stripslashes($_POST['email']);
        $body=stripslashes($_POST['body']);
        // validate e-mail address
        $valid=eregi('^([0-9a-z]+[-._+&])*[0-9a-z]+@([-0-9a-z]+[.])+[a-z]{2,6}$',$email);
        $crack=eregi("(\r|\n)(to:|from:|cc:|bcc:)",$body);
        
    		
    		if ($email && $body && $valid && !$crack){
          if (mail($to,$messageSubject,("Name: ".$name."\nPhone: ".$phone . "\nEmail: ". $email."\n\n". $body),'From: '.$email."\r\n")){
           
    ?>
    
    		<?php  
    									print ("<p class=\"success\">Thank you for contacting us. Your case information has been sent and we will be in touch with you soon.</p>");
    									?>
    <?php
            
          }else{ // the messages could not be sent
    ?>
    		<?php  
    									print ("<p class=\"fail\">Sorry, we're having problems with our server. Please contact us using the phone number above.</p>");
    									?>
    <?php
          }
        }else if ($crack){ // cracking attempt
    ?>
    <?php 	print ("<p class=\"fail\">Please enter a valid email address and describe your case.</p>"); ?>
    <?php
        }else{ // form not complete
    ?>
    <?php 	print ("<p class=\"fail\">Please enter a valid email address and describe your case.</p>"); ?>
    <?php
        }
      }
       }
    ?>
    
    PHP:
    That's my contact form code... Does anything seem wrong?
     
    taktikz, Nov 5, 2010 IP
  4. EGS

    EGS Notable Member

    Messages:
    6,078
    Likes Received:
    438
    Best Answers:
    0
    Trophy Points:
    290
    #4
    EGS, Nov 5, 2010 IP
  5. taktikz

    taktikz Active Member

    Messages:
    692
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #5
    What's weird about it? I would prefer using the original since it looks nice with the template I'm using.... Let me know.

    Thanks!
     
    taktikz, Nov 5, 2010 IP
  6. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #6
    First off, your form is not linked to the processing code pasted above... If that processing code is in the contact.html page, then part of the problem is that the page is .html and not .php - ( unless using mod_rewrite )

    Secondly the code above does have some issues... But I would first check the form being linked to the processor first...

    ===> <form action="PROCESSOR??" method="post">
     
    workingsmart, Nov 5, 2010 IP
  7. taktikz

    taktikz Active Member

    Messages:
    692
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #7
    That is the code inside send.php....

    This is the code for the form itself:
    
    
      <form action="" method="post">
                                                    <fieldset>
                                                    <input class="text" name="name" id="name" type="text" value="Name" />
                                                    </fieldset>
                                                    <fieldset>
                                                    <input class="text" name="email" id="email" type="text" value="Email" />
                                                    </fieldset>
                                                    <fieldset>
                                                    <input class="text" name="phone" id="phone" type="text" value="Primary Phone Number>" />
                                                    </fieldset>
                                                    <fieldset>
                                                    <textarea rows="" cols="" name="body" id="body">Please describe your case.
    </textarea>
                                                    </fieldset>
                                                    <p>
                                                          <input class="submit" type="submit" value="Click Here to Send" />
                                                    </p>
                                              </form>
    
    Code (markup):
     
    taktikz, Nov 5, 2010 IP
  8. taktikz

    taktikz Active Member

    Messages:
    692
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #8
    Just realized, I had to upload all php files. I had html files pointing to that send.php, which wasn't working... Everything is working fine now.

    Thanks for your help
     
    taktikz, Nov 5, 2010 IP
  9. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #9
    Cheers to you for figuring it out!~

    Your form action="" <== is blank... should be pointing to the send.php file for processing!

    Good Luck!! :)
     
    workingsmart, Nov 5, 2010 IP