January 13, 201016 yr Hi, Can someone please advise me on this. I've read the pinned article on the top of this forum but too inexperienced to understand it. Also, really don't want all those expletives as well!! So, the stage I'm at is this: HTML <form method="post" action="sendmail.php"> <fieldset> <legend>Please enter your contact details and your enquiry in the fields below:</legend> <br /> <p> <label for="fullname">Name:</label> <input type="text" name="fullname" id="fullname" class="txt" /> </p> <p> <label for="email">Email Address:</label> <input type="text" name="email" id="email" class="txt" /> </p> <p> <label for="telephone">Telephone:</label> <input type="text" name="telephone" id="telephone" class="txt" /> </p> <p> <label for="enquiry">Enquiry:</label> <textarea name="enquiry"></textarea> </p> <br /> <p><label for="comments">How would you like us to contact you:</label><br /> Please telephone me: <input type="checkbox" name="contactbyphone" value="Yes"> Email me the details please: <input type="checkbox" name="contactbyemail" value="Yes"><br /> </p> <p></p> <p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p> </fieldset> </form> And the php (which I'd prefer in as an external document) <?php if(isset($_POST['submit'])) { $to = "TOEMAIL"; $subject = "Contact Form Test"; $name_field = $_POST['fullname']; $email_field = $_POST['email']; $telephone = $_POST['telephone']; $enquiry = $_POST['enquiry']; $contactbyphone = $_POST['contactbyphone']; $contactbyemail = $_POST['contactbyemail']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "You're reading this cos the form was built by a complete n*bhead"; } ?> Any advise greatly received. Jo. Edited February 2, 201016 yr by wizely
January 13, 201016 yr Author I see that now, but would that stop everything working completely. Excuse my ignorance of php - it's a new years resolution to get it sorted. Thanks,
January 13, 201016 yr Yes it would. Try adding this variable: $mail_from = "FROMEMAIL"; and change the mail function to: mail($to, $subject, $body, "-f".$mail_from); If that still doesn't work, your php.ini file has not specified a default sendmail_from address and you need to specify it by adding this code above the mail function. ini_set("sendmail_from", $mail_from); Edited February 2, 201016 yr by wizely
Create an account or sign in to comment