Results 1 to 2 of 2

Thread: PHP Email Form help

  1. #1

    PHP Email Form help

    Dear Sir,
    I am designing a email form using PHP script from Kirupa.com

    After pressing the submit button.I am getting the message"Data has been submitted to nandugan@gmail.com!"

    Everything is perfect.

    But when i check my Inbox,i am not getting the details to my Inbox.

    Kindly,please anybody help me.

    Following is the html code:

    <form method="POST" action="mailer.php">
    <p>&nbsp;</p>
    <p><span class="style1">Name:</span>
    <input type="text" name="name" size="19" />
    <br />
    <br />
    <span class="style1">Company Name :</span>
    <input type="text" name="name" size="19" />
    <br />
    <br />
    <span class="style1">Telephone :</span>
    <input type="text" name="phone" size="19" />
    <br />
    <br />
    <span class="style1">E-Mail:</span>
    <input type="text" name="email" size="19" />
    <br />
    <br />


    <input type="checkbox" name="check[]" value="blue_color" />
    <span class="style1">Contact me for a free Consultation</span><br />
    <span class="style1">Send me a Organizer :</span>
    <input type="checkbox" name="check[]" value="green_color" />
    <span class="style1"> Electronic</span><br />

    <input type="checkbox" name="check[]" value="orange_color" />
    <span class="style1">Paper</span><br />

    <br />
    <br />
    <span class="style1">Select Items apply to you : </span>
    <select size="1" name="drop_down">
    <option>Select One</option>
    <option>I recevied Business Income</option>
    <option>I recevied rental/ royalty Income</option>
    <option>I purchased/ sold my home,stocks</option>
    <option>I have a retirement plan</option>
    <option>I had employee business expenses</option>
    <option>I received farm income</option>
    <option>I received a Schedule K1</option>
    <option>I incurred deductible Vechicle expenses</option>
    <option>I received other income</option>
    <option>I paid child dependant care expenses</option>
    <option>I incurred moving expenses</option>
    <option>I used my home for business</option>
    <option>I made non-cash contributions</option>
    <option>I paid adoption expenses </option>
    <option>I paid education expenses</option>
    <option>I paid household employment expenses</option>
    </select>
    <br />
    <br />
    <span class="style1">Message:</span><br />
    <textarea rows="6" name="message" cols="30"></textarea>
    <br />

    <br />
    <input type="submit" value="Submit" name="submit" />
    </p>
    </form>


    PHP mailer:
    <?php
    if(isset($_POST['submit'])) {

    $to = "nandugan@gmail.com";
    $subject = "From Bhupinder Sood CPA Tax Organizer Query";
    $name_field = $_POST['name'];
    $email_field = $_POST['email'];
    $message = $_POST['message'];
    $Telephone = $_POST['phone'];
    $dropdown = $_POST['drop_down'];

    foreach($_POST['check'] as $value) {
    $check_msg .= "Checked: $value\n";
    }

    $body = "From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n";

    echo "Data has been submitted to $to!";
    mail($to, $subject, $body);

    } else {
    echo "blarg!";
    }
    ?>


    I am newbie.So,kindly please anybody guide me.


    Thanks
    Suvetha.

  2. #2
    Your php file should be:
    PHP Code:
    <?php
    if(isset($_POST['submit'])) {

    $to "chris****ow@criticalmassmedia.com";
    $subject "From Bhupinder Sood CPA Tax Organizer Query";
    $name_field $_POST['name'];
    $email_field $_POST['email'];
    $message $_POST['message'];
    $Telephone $_POST['phone'];
    $dropdown $_POST['drop_down'];

    foreach(
    $_POST['check'] as $value) {
    $check_msg .= "Checked: $value\n";
    }
    //You needed a from header.
    $headers "From: ".$email_field." \n";
    $body "From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n";

    mail($to$subject$body$headers);
    echo 
    "Data has been submitted to $to!";
    } else {
    echo 
    "blarg!";
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012