I am getting this problem when i submit an online inquiry form. How i fix it.
My code is(mail.php) :

<?php 
require_once 'admin/common/config.php';


// Read POST request params into global vars 
$to      = "engmizan@gmail.com";
$from    = $_POST['email']; 
$subject = "Online Enquiry / Order Form";
// registration information

$name= $_POST['name'];
$desig= $_POST['desig'];//desig
$compname= $_POST['compname']; //COM
$address= $_POST['address'];
$country= $_POST['country'];
$contact = $_POST['contact'];
$email= $_POST['email'];
$comments= $_POST['comments'];


// Sending Information


$message ="Buyer/User Info
          Name : $name 
          Designation :$desig  
          Company Name :$compname
          Address :$address 
          Nationality :$country  
          Contact No:$contact
          email :$email  
          Comments :$comments";



// Send the message 
$headers .= "Content-type: text/html\r\n";
 $headers  .= "From: $from\r\n"; 

$ok = @mail($to, $subject, $message, $headers); 
if ($ok) 
{  

$msg= "You Mail and comment Successfully Send";
header ("location:confirm.php");

} 

else { 
     $msg=  "Sorry!  Mail could not be sent. ";

header ("location:deny.php?msg=$msg");
} 


?>

Recommended Answers

All 4 Replies

ensure that you don't have any whitespace after the closing php '?>' tag in your include files and that you are not echoing or printing anything prior to sending headers with the header() function. Any content printed prior to sending a header will cause errors like that, and can be caused by something as simple as a space or newline character trailing the '?>' tag. For this reason, it is usually recommended that you omit the '?>' tag in your php includes if no other content is to follow it in the same document.

post the full error. it should have a php file name and line #. that's helpful.


also, check config.php and make sure that it's not outputting some test code that you don't want.

Warning: Cannot modify header information - headers already sent by (output started at /home/jumpinds/public_html/computer/inc/header.php:9) in /home/jumpinds/public_html/computer/yantra.php on line 17

post the relevant code
the file posted four years ago by the OP, does not look like header.php, the included file that has output where there should not be any

edit:
It may be as simple as moving the line include '/computer/inc/header.php';

after the mail processor redirects

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.