Hi Kishanterry, Thank you for your reply. Your code works, at least I can get an email but no details get through? I've included both files - maybe you can find the error. Thank you. contact.php <form name="form1" method="post" action="send_contact.php"> <br> <div> <p> <label>Name:</label><br> <input type="text" style="color: #37383D; background-color: white;" name="subject" type="text" id="subject" value="" size="60" /> </p> <p> <label>Telephone:</label><br> <input type="text" style="color: #37383D; background-color: white;" name="name" type="text" id="name" value="" size="60" /> </p> <p> <label>Email Address:</label><br> <input type="text" style="color: #37383D; background-color: white;" name="customer_mail" type="text" id="customer_mail" value="" size="60"/> </p> <p> <lable>Comment:</label><br> <textarea rows="6" cols="45" style="color: #37383D; background-color: white;" name="detail" id="detail"></textarea> </p> <br><p style="margin-left: 100px"> <Input type="submit" name="Submit" style="color: white;background: #6C7079; width: 80px; border: 1px solid #B9C0CA;font-family: arial; font-size: 11px ;height: 26px;" value="Send Email"> <Input type="reset" name="send_mail" style="color: white;background: #6C7079; width: 80px; border: 1px solid #B9C0CA;font-family: arial; font-size: 11px ;height: 26px;" value="Reset"></p> </form> </div> PHP: send_contact.php <div> <?php // Contact subject $subject ="$subject"; // Details $body="$detail"; $to = 'le007@myemailaddress.com '; $subject = 'Contact Form'; $mail_sent = mail($to, $subject, $body); echo $mail_sent ? "Mail sent" : "Mail failed"; ?> </div> PHP: I'm just receiving a blank email?
Hi le007, Modify the following code: to: $body = $_POST['detail']; PHP: and try to send the mail. And if that works append the rest of the form fields to the $body variable according to your tastes and preferences. Cheers
it is usually good practice to end your header part with \r\n for examples; $headers = "From: \r\n"; mail( 'someone@somewhere.com', 'the subject', 'the body', $headers);
Woohoo ! Winner, winner, chicken dinner! Excellent, thanks very much kishanterry, kellyphong, suryawl and everyone else who posted to this thread. Finally, it worked - I will duplicate it for the rest but yes, the details went through successfully ",)
Eek, may have spoken too soon - tried to change the subject and got an error: The code for my form is still the same as my previous above comment - would somebody please kindly change what it needed so that I can get the name, telephone, email and details sent ",) Thank you very much.
Last shot effort and it's not working ? <?php // Contact subject $name ="$_POST['subject']; // Details $tele = $_POST['name']; $email = $_POST['customer_mail']; $body = $_POST['detail']; $to = 'myemail@gmail.com '; $subject = 'Contact Form'; $mail_sent = mail($to, $subject, $name, $tele, $email, $body); echo $mail_sent ? "Mail sent" : "Mail failed"; ?> PHP:
Hi le007, Try the following: $body = "Name: " . $_POST['subject'] . "\r\nTelephone: " . $_POST['name'] . "\r\nE-mail: " . $_POST['customer_email']; $body .= "\r\nDetails:\r\n" . $_POST['detail']; $to = 'myemail@gmail.com '; $subject = 'Contact Form'; $mail_sent = mail($to, $subject, $body); echo $mail_sent ? "Mail sent" : "Mail failed"; PHP: There we two problems in your code (as far as I know): 1. $name ="$_POST['subject']; PHP: The quote (") in front of $_POST... is a syntax error. 2. And the mail() function was taking too many parameters.
Hi Kishanterry, Thanks a million for your reply and all the help. You really have helped me out here! It's working precisely how I'd like it to. Appreciate it! Le007
Hi le007, Happy to help. I believe you are a CSS person. Could you please look into my problem and see if you could help me. Unfortunately I am not allowed to post links, but the precise title of my post is Overriding td height="?" using CSS. Thanks in advance.