Jump to content

Can any body work out why this is returning an error?


loquela

Recommended Posts

Hi there,

 

I've reposted this query as a mistake in my first attempt threw evrybody off the real issue (I apologise):

 

I'm pulling my hair out with this one. When this mail script is run (actioned from a seperate form), the mail appears to be sent fine but the HTML wont display because the script causes an internal error:

 

 

 

 

malformed header from script. Bad header=/home/sites/e***ign.: confirm.php, referer: http://www.educationaldesign.co.uk/school_enquiry.php


Can anybody see why the header is being corrupted?
Here's the code:
Code:
<?php
ini_set('arg_separator.output','&');


$enq=$_POST['enquiry_type'];
$name=$_POST['name'];
$org=$_POST['organisation'];
$sch=$_POST['school'];
$lea=$_POST['lea'];
$email=$_POST['email'];
$tel=$_POST['tel'];
$fax=$_POST['fax'];
$prod=$_POST['product'];
$msg=$_POST['msg'];
$pcms=$_POST['primary_cms'];
$scms=$_POST['secondary_cms'];



$body= "Dear {$name}, \nThank you for your enquiry. \nYour message has been received by the Educational Web Design team. \nYou sould receive a responce within the next 48 hours.\n\nEducational Web Design.";
mail($email, 'Thank you for your Enquiry', $body, 'From: info@e*******.co.uk');

mail('info@*******.co.uk',

/* Subject */ 'Educational Web Design - Web Enquiry',

"Enquiry Type: {$enq}\n
Name: {$name}\n
Organisation: {$org}\n
School:{$sch}\n
LEA: {$lea}\n
Email: {$email}\n
Telephone: {$tel}\n
Fax: {$fax}\n
Product: {$prod}\n
Message: {$msg}\n
Primary CMS Demo: {$pcms}\n
Secondary CMS Demo: {$scms}\n
",

"From: {$email}");



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
       <html xmlns="http://www.w3.org/1999/xhtml"
             xml:lang="en">
<head>
<title>School Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="title" content="Enquiry confirmation page" />
<meta name="author" content="Educational Web Design Limited" />
<meta name="description" content="Page confirming receipt of online enquiry" />
<meta name="keywords" content="online enquiry, confirmation" />
</head>

<body>
...... 

 

I got this reply from another forum. Perhaps it helps...

 

http://www.google.nl/search?q=%22malformed+header+from+script.+Bad+header%3D%22&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a

 

Looks like the problem isn't PHP-specific, but rather CGI-specific (and that tells me that your PHP runs as a CGI app). But the solution ... I dunno ^_^;;

 

And my reply to this:

 

Thanks Zyppora,

 

I think you got it! I know this script is valid as I had it working on a previous server no problem. I also had other people test it. I have migrated to a new hosting provider and they insist on running php as cgi. So I am convinced it is a cgi problem and nothing to do with the PHP.

 

Does anyone have an idea to a solution? If this turns out to be a cgi issue it could cause problems with any script. I need to find out how to get around it.

 

Anybody out there have any clues????

Many thanks,

 

Not sure what information you need. Here is the output from Page Info > Headers: from my page where the form is:

 

GET /general_enquiry.php HTTP/1.1
www.educationaldesign.co.uk
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
en-us,en;q=0.5
gzip,deflate
ISO-8859-1,utf-8;q=0.7,*;q=0.7
300
keep-alive
__utma=107056214.1821490878.1173285502.1173285502.1173285502.1; __utmb=107056214; __utmc=107056214; __utmz=107056214.1173285502.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); style=default
max-age=0

HTTP/1.1 200 OK
Wed, 07 Mar 2007 16:54:13 GMT
Apache/2.0.55 (Red Hat)
PHP/4.4.4
timeout=15, max=99
Keep-Alive
chunked
text/html

 

And here is the output form the php processing page:

 

POST /confirm.php HTTP/1.1
www.educationaldesign.co.uk
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070216 Firefox/1.5.0.10
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
en-us,en;q=0.5
gzip,deflate
ISO-8859-1,utf-8;q=0.7,*;q=0.7
300
keep-alive
http://www.educationaldesign.co.uk/general_enquiry.php
__utma=107056214.1821490878.1173285502.1173285502.1173285502.1; __utmb=107056214; __utmc=107056214; __utmz=107056214.1173285502.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); style=default
max-age=0
application/x-www-form-urlencoded
248


HTTP/1.1 500 Internal Server Error
Wed, 07 Mar 2007 16:57:59 GMT
Apache/2.0.55 (Red Hat)
647
close
text/html; charset=iso-8859-1

 

I really hope this helps provide answers.

i feel something wrong with mailheaders settings

 

<?php

ini_set('arg_separator.output', '&');

$enq = $_POST['enquiry_type'];

$name = $_POST['name'];

$org = $_POST['organisation'];

$sch = $_POST['school'];

$lea = $_POST['lea'];

$email = $_POST['email'];

$tel = $_POST['tel'];

$fax = $_POST['fax'];

$prod = $_POST['product'];

$msg = $_POST['msg'];

$pcms = $_POST['primary_cms'];

$scms = $_POST['secondary_cms'];

$mailheaders = "From: My Web Site <[email protected]>\n";

$mailheaders .= "Reply-To: ".$_POST["email"];

$body = "Dear {$name}, \nThank you for your enquiry. \nYour message has been received by the Educational Web Design team. \nYou sould receive a responce within the next 48 hours.\n\nEducational Web Design.";

mail($email,$body, $mailheaders);

//try setting mail like this

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.