www.webdeveloper.com
Results 1 to 2 of 2

Thread: problem with header

  1. #1
    Join Date
    Sep 2008
    Posts
    205

    problem with header

    <?

    if ($_POST["name"])

    {






    $kind = " 1111 Co";

    $name=htmlspecialchars($_POST['name']);
    $emal=htmlspecialchars($_POST['emal']);
    $city=htmlspecialchars($_POST['city']);
    $country=htmlspecialchars($_POST['country']);
    $tel=htmlspecialchars($_POST['tel']);
    /*echo $kind;
    echo $name;
    echo $emal;
    echo $city;
    echo $country;
    echo $tel;*/
    ?>



    <?

    $messageo = '

    <html>
    <head>
    <style>

    body {

    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #737373;
    text-align: justify;
    width: auto;
    margin-right: 0px;
    margin-left: 0px;
    margin-top: 10px;
    margin-bottom: 10px;
    line-height: 17px;
    }
    .padding {
    padding-left: 30px;
    background-color: #cdcdcd;
    color: #023061;
    height: 30px;
    vertical-align: middle;
    }
    .padding2 {
    padding-left: 30px;
    background-color: #E5E5E5;
    color: #023061;
    height: 30px;
    }

    .title1 {
    font-size: 17px;
    font-weight: bold;
    color: #023061;
    padding-top: 20px;
    padding-bottom: 25px;
    font-family: Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    }

    </style>

    </head>
    <body>
    <div class="title1" align="center">Kay & Co</div>
    <table width="50%" border="0" cellspacing="1" cellpadding="4" align="center">
    <tr class="padding">
    <td width="30%"><strong>Name <b></strong> </td>
    <td >' . $name . '</td>
    </tr>

    <tr class="padding2">
    <td ><strong>E-mail </strong> </td>
    <td >' . $emal . '</td>
    </tr>



    <tr class="padding">
    <td><strong> City </strong> </td>
    <td>' .$city . '</td>
    </tr>
    <tr class="padding2">
    <td><strong>Country</strong> </td>
    <td>'.$country.'</td>
    </tr>
    <tr class="padding">
    <td><strong>Telephone</strong> </td>
    <td>' . $tel.'</td>
    </tr>
    </table>

    </body>
    </html> ';





    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=windows-1256\r\n";
    $headers .= "From: info@abccc.com>\r\n";
    $headers .= "cc: john.zakaria@abc.com\r\n";



    $ok = mail("john@abc.com", $kind, $messageo, $headers);


    }
    header("Location: welcome.php");


    // here i got the error "cannot modify header information


    ?>



    i have a problem wiz header here coz when i post data from a form to this page to send an e-mail , i force the page to go to welcome.php using header but it show me a message
    " CANNOT MODIFY HEADER INFORMATION"
    i treid to remove the <html><body >.... tags and it could not work correctly it shows the same message


    and when i tried to put the header in the top of the code it did not work correctly on the server
    can anyone help me plz




  2. #2
    Join Date
    Nov 2008
    Posts
    2,477
    You cannot send a header after you have echoed output. Headers can only be sent before any output is echoes because echoing sends a header automatically.

    Also PLEASE use php tags when posting code, I was ready to just hit back like I do with most threads where the code is not formatted properly, I only posted because it was so quick to see the problem in this case.

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
  •  
HTML5 Development Center



Recent Articles