Jeff_Grantmeyer Posted April 16, 2014 Share Posted April 16, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/287822-php-mailer-help/ Share on other sites More sharing options...
cyberRobot Posted April 16, 2014 Share Posted April 16, 2014 Have you tried using an actual submit button? http://www.echoecho.com/htmlforms12.htm Also note that your input fields need to include the "name" attribute. Otherwise PHP won't be able to access the values sent through the form. Quote Link to comment https://forums.phpfreaks.com/topic/287822-php-mailer-help/#findComment-1476422 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.