Jump to content

Recommended Posts

Need some help, made one mailer form on my website classiccarbines.com to work but cannot get the simple contact us form to function without error. I am sure I am missing something simple but I have looked too long and as a self taught hack cannot resolve this one.

 

Form code:

 

         <h2>Contact Form</h2>
            <form id="form" action="contactmailer.php" method="post" >
              <fieldset>
                <label><input type="text" id="Name" value="Name" onBlur="if(this.value=='') this.value='Name'" onFocus="if(this.value =='Name' ) this.value=''"></label>
                <label><input type="text" id="Email" value="Email" onBlur="if(this.value=='') this.value='Email'" onFocus="if(this.value =='Email' ) this.value=''"></label>
                <label><input type="text" id="Phone" value="Phone" onBlur="if(this.value=='') this.value='Phone'" onFocus="if(this.value =='Phone' ) this.value=''"></label>
                <label><textarea onBlur="if(this.value==''){this.value='MESSAGE'}" onFocus="if(this.value=='MESSAGE'){this.value=''}" id="message">MESSAGE</textarea></label>
                <div class="btns"><a href="#" class="button">Clear</a><a href="#" class="button" onClick="document.getElementById('form').submit();">Send</a></div>
              </fieldset>  
            </form> 
 
PHP Script:
 
<?php
 
if(isset($_POST['submit'])) {
 
$to = "email@email.com";
$subject = "Classic Carbines Quote Inquiry"; 
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$message = $_POST['message'];
$body = "Name: $name\n Phone: $phone\n Email: $email\n Messge: $message";
mail($to, $subject, $body);
header('Location:  infosent.html');
 
}else{
echo "error! :'(";
}
 
 
?>

 

Please help, and thank you in advance

Link to comment
https://forums.phpfreaks.com/topic/287822-php-mailer-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.