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

Thread: Urgnt Help

  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Urgnt Help

    Hi I am trying to create a simple quote/info request on our website

    www.cpberry.com

    but seem to be having major problems with it, when we submit the form we get the following error

    '; $email=$_POST['email']; $name=$_POST['name']; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: $name <$email>"; $subject='Message from the site'; $send_contact=mail($to,$subject,$message,$headers); if ($send_contact) header("Location: http://www.cpberry.com/thanks.html"); else echo "There was an error"; } ?>

    The script I have used is as follows:

    <?php
    $to = 'aaronlee@cpberry.com';

    if ($_POST['submit'])
    {
    $message='<html>
    <head>
    <title>Message from the Site</title>
    </head>
    <body>
    <p>'.$_POST['message'].'</p>
    </body>
    </html>';
    $email=$_POST['email'];
    $name=$_POST['name'];
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= "From: $name <$email>";
    $subject='Message from the site';
    $send_contact=mail($to,$subject,$message,$headers);
    if ($send_contact)
    header("Location: http://www.cpberry.com/thanks.html");
    else
    echo "There was an error";
    }
    ?>


    Can anyone shed any light on this,

    Thanks in advance

  • #2

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,325
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    It's possible that its a file permission problem. If you're on linux try chmod'ing the file to 755. If you're on windows then it doesn't matter and its probably a misconfiguration in a config file somewhere.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

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