contact form not working

Discussion in 'PHP' started by corn, Feb 1, 2014.

  1. #1
    My contact form is not working. Any Ideas? Link: http://bball.x10.mx/first/site/Contact.html

    the php:
    <?php
    $field_name = $_POST['cf_name'];
    $field_email = $_POST['cf_email'];
    $field_message = $_POST['cf_message'];
    
    $mail_to = 'myname@hotmail.com';
    $subject = 'Message from a site visitor '.$field_name;
    
    $body_message = 'From: '.$field_name."\n";
    $body_message .= 'E-mail: '.$field_email."\n";
    $body_message .= 'Message: '.$field_message;
    
    $headers = 'From: '.$field_email."\r\n";
    $headers .= 'Reply-To: '.$field_email."\r\n";
    
    $mail_status = mail($mail_to, $subject, $body_message, $headers);
    
    if ($mail_status) { ?>
        <script language="javascript" type="text/javascript">
            alert('Thank you for the message. We will contact you shortly.');
            window.location = 'contact_page.html';
        </script>
    <?php
    }
    else { ?>
        <script language="javascript" type="text/javascript">
            alert('Message failed. Please, send an email to email');
            window.location = 'contact_page.html';
        </script>
    <?php
    }
    ?>
    PHP:
    and the html:
    <form id="ContactForm" action="contact.php" method="post">
                                    <div>
                                        <div  class="wrapper">
                                            <strong>Name:</strong>
                                            <div class="bg"><input type="text" name="cf_name" class="input" ></div>
                                        </div>
                                        <div  class="wrapper">
                                            <strong>Email:</strong>
                                            <div class="bg"><input type="text" name="cf_email" class="input" >    </div>                          
                                        </div>
                                        <div  class="textarea_box">
                                            <strong>Message:</strong>
                                            <div class="bg"><textarea name="cf_message" cols="1" rows="1"></textarea>        </div>                      
                                        </div>
                                        <a href="#" class="button" onClick="document.getElementById('ContactForm').submit()"><span><span>Send</span></span></a>
                                        <a href="#" class="button" onClick="document.getElementById('ContactForm').reset()"><span><span>Clear</span></span></a>
                                    </div>
                                </form>
    HTML:
    It seems to say it works, but i don't receive anything in my email.
     
    Solved! View solution.
    corn, Feb 1, 2014 IP
  2. #2
    CoreyPeerFly, Feb 1, 2014 IP
  3. corn

    corn Member

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    Ok, I was thinking that, and I assume dreamweaver doesn't either :rolleyes:
     
    corn, Feb 1, 2014 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    They do. Read: https://www.x10hosting.com/free-hosting-comparison - all of them allow PHP Sendmail. What Dreamweaver have to do with anything, I've no idea (do people still use Dreamweaver? I haven't really heard about it for at least 2-3 years).
     
    PoPSiCLe, Feb 1, 2014 IP
  5. corn

    corn Member

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #5
    Yes people still use dreamweaver, it's very useful. And I just brought it up because that's what I'm designing my site on, and x10 is my testing site. x10's emailing doesn't work because this works fine on my normal website.

    EDIT: just saw the page you linked to, that is x10premium not free. Free does not have sendmail
     
    corn, Feb 1, 2014 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Uhm - reading is not your strong point? All of the three choices, Free, Illuminated and Premium have a green checkmark next to PHP Sendmail.
    And how the HELL is Dreamweaver useful? For what? It's a horrible gruesome mess of crappy code and deprecated syntax. (Maybe they've redone the engine, so it produces better code now than it used to, but I wouldn't be surprised if it didn't).
    Use a text-editor, and a browser.
     
    PoPSiCLe, Feb 2, 2014 IP