Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Thanked 0 Times in 0 Posts

    Angry Struggling to get the content from the html form through php script

    My html form is send me empty emails. Kindly help me with this. I'll be grateful to you all.

    My HTML Code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Biology Solutions</title>
    <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
    <link rel="shortcut icon" href="http://www.biologysolutions.in/images/favicon.ico"/>
    <h2>Contact form</h2>

    <form name="contactform" method="post" action="send_form_email.php">

    <div id="contact_form">

    <div class="form_row">
    <input type="text" name="name" class="contact_input" />

    <div class="form_row">
    <input type="text" name="email" class="contact_input" />

    <div class="form_row">
    <input type="text" name="phone" class="contact_input" />

    <div class="form_row">
    <textarea name="message" class="contact_textarea"></textarea>

    <div class="send">
    <a href="http://www.biologysolutions.in/send_form_email.php">send</a>



    </div><!--end of right content-->

    <div style=" clear:both;"></div>
    </div><!--end of main content-->

    <div id="footer">
    <div class="copyright">
    <a href="home.html"><img src="images/footer_logo.gif" border="0" alt="" title="" /></a>
    <div class="footer_links">
    <a href="about.html">About us</a>
    <a href="privacy.html">Privacy policy</a>
    <a href="contact.html">Contact us </a>

    </div> <!--end of main container-->

    Here is my php Code:


    /* Subject and Email Variables */

    $emailsubject = 'New Message';
    $webMaster = 'info@website.in'; /* Here I've given my email*/

    /* Gathering Data Variables */

    $nameField = $_POST['name'];
    $emailField = $_POST['email'];
    $phoneField = $_POST['phone'];
    $messageField = $_POST['message'];

    $body = <<<EOD
    Name: $name <br>
    Email: $email <br>
    Phone Number: $phone <br>
    Message: $message <br>

    $headers = "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailsubject, $body, $headers);

    Once again I'm requesting you all to help me. I've been struggling to get this right for the past three days and I'm frustrated. Desperate to get this done. Help me.


  • #2
    Senior Coder
    Join Date
    Feb 2011
    Your Monitor
    Thanked 546 Times in 533 Posts
    This line:
    $success = mail($webMaster, $emailsubject, $body, $headers);

    What is the value of $success? - true or false?
    I can't really think of anything to write here now...


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts