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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with PHP contact form

    Hi there

    If anyone could help with this I'd be extremely grateful. The contact form on my site is returning messages of:

    From: $fullName\nSender E-mail address: $header\nCompany name: $subject\nContact number: $contactNumber\nTOCR Version: $version\nOS: $OS\nMessage: $comment\n

    for every message.

    I know I must have made a coding error somewhere, but for the life of me I can't see it, if someone else can I'll be very grateful.

    The form is:

    <form action="emailProcessor.php" method="post">
    <table style="width: 780px">
    <tr>
    <td class="style1" style="height: 26px">
    <label for="name" class="style1">Name</label></td>
    <td style="height: 26px"><input name="fullName" size="40" type="text" /></td>
    </tr>
    <tr>
    <td class="style1">Company name</td>
    <td><input name="companyName" size="40" tabindex="2" type="text" /></td>
    </tr>
    <tr>
    <td class="style1" style="height: 26px">E-mail</td>
    <td style="height: 26px"><input name="eMail" size="40" tabindex="2" type="text" /></td>
    </tr>
    <tr>
    <td class="style1" style="height: 26px">Contact number</td>
    <td style="height: 26px"><input name="contactNumber" size="40" tabindex="2" type="text" /></td>
    </tr>


    <tr>
    <td class="style1" style="height: 26px">TOCR Version</td>
    <td style="height: 26px"><select name="version">
    <option></option>
    <option>1.4</option>
    <option>2.0</option>
    <option selected="selected">3.0</option>
    </select></td>
    </tr>
    <tr>
    <td class="style1" style="height: 26px">Operating System</td>
    <td style="height: 26px"><select name="OS">
    <option></option>
    <option>Windows 95</option>
    <option>Windows 98</option>
    <option>Windows ME</option>
    <option>Windows NT</option>
    <option>Windows 2000</option>
    <option selected="selected">Windows XP</option>
    <option>Windows Vista</option>
    </select></td>
    </tr>

    <tr>
    <td class="style1">Message</td>
    <td><textarea cols="70" name="Comment" rows="8" tabindex="4"></textarea>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;&nbsp;</td>
    <td>
    <input name="submitButton" tabindex="5" type="submit" value="submit" /><input name="resetButton" tabindex="6" type="reset" value="Reset" />&nbsp;</td>
    </tr>
    </table>
    </form>


    and the emailProcessor.php page is

    <?php

    $to = 'support@transym.com';
    $subject = $_POST['companyName'];
    $header = $_POST['eMail'];
    $message = 'From: $fullName\nSender E-mail address: $header\nCompany name: $subject\nContact number: $contactNumber\nTOCR Version: $version\nOS: $OS\nMessage: $comment\n';

    if ($header =="") {
    echo "<meta http-equiv=\"refresh\" content =\"0;URL=error.htm\">";
    exit;
    }

    $success = mail ($to, $subject, $message, "From: <$header>");

    if ($success){
    echo "<meta http-equiv=\"refresh\" content =\"0;URL=success.htm\">";
    }
    else {
    echo "<meta http-equiv=\"refresh\" content =\"0;URL=failure.htm\">";
    }


    ?>


    Anyone got any idea what I've buggered up?

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Change:

    Code:
     $message = 'From: $fullName\nSender E-mail address: $header\nCompany name: $subject\nContact number: $contactNumber\nTOCR Version: $version\nOS: $OS\nMessage: $comment\n';
    to:

    Code:
     $message = 'From: '.$fullName."\n".'Sender E-mail address: '.$header."\n".'Company name: '.$subject."\n".'Contact number: '.$contactNumber."\n".'TOCR Version: '.$version."\n".'OS: '.$OS."\n".'Message: '.$comment."\n";

  • #3
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Brilliant, thank you so much it's completely sorted now.


  •  

    Posting Permissions

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