Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Email Post Errors

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #145119

    Hello I am getting a small problem saying can not din my php file. So That can send emails from my website.

    Here is html

        <div class="span3">
    
                    <form method="post" action="http://mwbcomputers.com.au/contactform-testing/starter-template.html/contact-form-submission.php">
                        <div class="controls controls-row">
                        <input id="name" name="name" type="text" class="span3" placeholder="Name">
                        </div>
    
                        <div class="controls controls-row">
                        <input id="email" name="email" type="email" class="span3" placeholder="Email address">
                        </div>
    
    
                        <div class="controls">
                        <textarea id="message" name="message" class="span3" placeholder="Your Message" rows="5"></textarea>
                        </div>
    
                        <div class="controls">
                        <button id="contact-submit" type="submit" class="btn btn-primary input-medium pull-right">Send</button>
                        </div>
                    </form>
    
                </div>    
    

    here is php

            <?php  
    
            // check for form submission - if it doesn't exist then send back to contact form  
            if (!isset($_POST["save"]) || $_POST["save"] != "contact") {  
                header("Location: http://mwbcomputers.com.au/contactform-testing/starter-template.html/contact-form-submission.php"); exit;  
            }  
    
            // get the posted data  
            $name = $_POST["contact_name"];  
            $email_address = $_POST["contact_email"];  
            $message = $_POST["contact_message"];  
    
            // check that a name was entered  
            if (empty ($name))  
                $error = "You must enter your name.";  
            // check that an email address was entered  
            elseif (empty ($email_address))   
                $error = "You must enter your email address.";  
            // check for a valid email address  
            elseif (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email_address))  
                $error = "You must enter a valid email address.";  
            // check that a message was entered  
            elseif (empty ($message))  
                $error = "You must enter a message.";  
    
            // check if an error was found - if there was, send the user back to the form  
            if (isset($error)) {  
                header("Location: contact-form.php?e=".urlencode($error)); exit;  
            }  
    
            // write the email content  
            $email_content = "Name: $name\n";  
            $email_content .= "Email Address: $email_address\n";  
            $email_content .= "Message:\n\n$message";  
    
            // send the email  
            mail ("[email protected]", "New Contact Message", $email_content);  
    
            // send the user back to the form  
            header("Location:http://mwbcomputers.com.au/contactform-testing/starter-template.html/contact-form-submission.php?s=".urlencode("Thank you for your message.")); exit;  
    
            ?>  
    
    #145125

    Will not pick up the location in php file i am using bootstrap

    #145240

    Oh ok I thought it might work in my test folder.

    Also if I have it in footer do I need to put footer where it says header. and the if I have a separate contact page.

    Is there any way to get it to work on a sub folder for testing purposes.

    bootstrap its all new to me. staring to pick skill of bootstrap up its a lot easier than some others.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.