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

    PHP email form help

    Making a service request form for a website. the resulting email shows
    Email: fdgdfgdfg@gmail.com
    First Name:
    Last Name:
    Phone Number:
    Cell Phone Number:
    Address:
    New System Quote:
    Service Call:
    Product Info:
    Other:
    but not the other form items.
    PHP form is this:
    <?php

    /* Incoming Subject and Email Variables - Fixed */

    $emailSubject = 'Service Request Form';
    $webMaster = 'email@email.com, email@email.com';

    /* Gathering Data Variables - User Data */

    $first = $_POST['first'];
    $last = $_POST['last'];
    $phone = $_POST['phone'];
    $cell = $_POST['cell'];
    $address = $_POST['address'];
    $new = $_POST['new'];
    $service = $_POST['service'];
    $product = $_POST['product'];
    $other = $_POST['other'];
    $comments = $_POST['comments'];

    $email = $_POST['email'];


    $body = <<<EOD
    <br><hr><br>
    Email: $email <br>
    First Name: $first <br>
    Last Name: $last <br>
    Phone Number: $phone <br>
    Cell Phone Number: $cell <br>
    Address: $address <br>

    New System Quote: $new <br>
    Service Call: $service <br>
    Product Info: $product <br>
    Other: $other <br>
    <hr/>
    Comments: $comments <br>
    EOD;

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

    /* Results rendered as code */

    $theResults = <<<EOD
    <html>
    <head>
    <title>Thanks</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    background-color: #ff0000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #ooooo;
    text-decoration: none;
    }
    -->
    </style>
    </head>
    <body>
    <div>
    <div align="left">Thank you! Your service request will be answered very soon!</div>
    </div>
    <a href="http://www.secureittrinidad.com"> Click Here to go back to Secure It's Home Page <a/>


    </body>
    </html>
    EOD;
    echo $theResults;
    ?>


    Form HTML is this:

    <form id="form_209708" class="appnitro" method="post" action="http://secureittrinidad.com/form.php">
    <input type="hidden" name="required" value="email:Your email address" />
    <div class="form_description">
    <h2 class="style7">Service Request Form</h2>
    <p class="style7">Contact Secure It for help on your existing system or installing a new system.</p>
    </div>
    <ul >
    <li id="li_1" >
    <label class="description" for="element_1">Name </label>
    <span>
    <input id="first" name= "first" class="element text" maxlength="255" size="8" value=""/>
    <label>First</label>
    </span> <span>
    <input id="last" name= "last" class="element text" maxlength="255" size="14" value=""/>
    <label>Last</label>
    </span> </li>
    <li id="li_2" >
    <label class="description" for="element_2">Phone </label>
    <div>
    <input id="phone" name="phone" class="element text medium" type="text" maxlength="255" value=""/>
    </div>
    </li>
    <li id="li_6" >
    <label class="description" for="element_6">Cell Phone </label>
    <div>
    <input id="cell" name="cell" class="element text medium" type="text" maxlength="255" value=""/>
    </div>
    </li>
    <li id="li_3" >
    <label class="description" for="element_3">Email </label>
    <div>
    <input id="email" name="email" class="element text medium" type="text" maxlength="255" value=""/>
    </div>
    </li>
    <li id="li_4" >
    <label class="description" for="element_4">Address </label>
    <div>
    <textarea id="address" name="address" class="element textarea small"></textarea>
    </div>
    </li>
    <li class="section_break">
    <h3 class="style8">Service Requested</h3>
    <p></p>
    </li>
    <li id="li_9" >
    <label class="description" for="element_9"></label>
    <span>
    <input id="new" name="new" class="element radio" type="radio" value="1" />
    <label class="choice" for="element_9_1">New System Quote</label>
    <input id="service" name="service" class="element radio" type="radio" value="2" />
    <label class="choice" for="element_9_2">Repair/Service on your system</label>
    <input id="product" name="product" class="element radio" type="radio" value="3" />
    <label class="choice" for="element_9_3">Info about our products</label>
    <input id="other" name="other" class="element radio" type="radio" value="4" />
    <label class="choice" for="element_9_4">Other</label>
    </span> </li>
    <li id="li_7" >
    <label class="description" for="element_7">Comments </label>
    <div>
    <textarea id="comments" name="comments" class="element textarea medium"></textarea>
    </div>
    </li>
    <li class="section_break">
    <h3></h3>
    <p></p>
    </li>
    <li class="buttons">
    <input type="hidden" name="form_id" value="209708" />
    <input id="saveForm" class="button_text" type="submit" name="submit" value="Send Request" style="background-color:#ff0000;color:#000000;" />
    </li>
    </ul>
    </form>


    Thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    PHP form is this:
    <?php

    /* Incoming Subject and Email Variables - Fixed */
    Try
    PHP Code:
    if(isset($_POST['submit'])){
    /* Incoming Subject and Email Variables - Fixed */

    $emailSubject 'Service Request Form';
    $webMaster 'email@email.com, email@email.com';

    /* Gathering Data Variables - User Data */

    $first $_POST['first'];
    $last $_POST['last'];
    $phone $_POST['phone'];
    $cell $_POST['cell'];
    $address $_POST['address'];
    $new $_POST['new'];
    $service $_POST['service'];
    $product $_POST['product'];
    $other $_POST['other'];
    $comments $_POST['comments'];

    $email $_POST['email'];


    $body = <<<EOD
    <br><hr><br>
    Email: $email <br>
    First Name: $first <br>
    Last Name: $last <br>
    Phone Number: $phone <br>
    Cell Phone Number: $cell <br>
    Address: $address <br>

    New System Quote: $new <br>
    Service Call: $service <br>
    Product Info: $product <br>
    Other: $other <br>
    <hr/>
    Comments: $comments <br>
    EOD;

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

    /* Results rendered as code */

    $theResults = <<<EOD
    <html>
    <head>
    <title>Thanks</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    background-color: #ff0000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #ooooo;
    text-decoration: none;
    }
    -->
    </style>
    </head>
    <body>
    <div>
    <div align="left">Thank you! Your service request will be answered very soon!</div>
    </div>
    <a href="http://www.secureittrinidad.com"> Click Here to go back to Secure It's Home Page <a/>


    </body>
    </html>
    EOD;
    echo 
    $theResults;

    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    bahamabaker (03-23-2010)

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Tried that, no luck

  • #4
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    fixed it...thanks

  • #5
    New to the CF scene
    Join Date
    Apr 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In such case I suggest to use form builder. There is no need in monotonous copy-pasting. It creates all types of forms.


  •  

    Posting Permissions

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