send email script


I have a script that has been working fine, but I have moved the site to a new host and now the email send script does not work. It sends the email but the parameters are no longer passed from my html form.

I have been looking at the script to try and understand why.

one line reads :


I am not sure exact what the $host… does??

PHP is working fine on the new host, so theoretically the script should also work as normal.

any pointers?


Post the entire code.


Where is the $host[referer] set, and what is it set to?


Here is the script below the lines building the HTML message.


<? } else{ if(ereg(",",$email)|| ereg(";",$email)){ ?> <? } else{ $headers = "From: $emailn"; $headers.= "Bcc: $ccmailn"; $headers.= "Content-Type: text/html; charset=windows-874"; #mail("$to","$subject", "$msg", "$headers"); if (mail("$to","$subject", "$msg", "$headers")) { echo header("location: ../thanks.html"); } else { echo "not"; } } }


Why do you use apache_request_headers(), rather than the superglobal $_SERVER? I presume your new host runs on Apache, or else the function would have returned an error, but I’m not sure if it returns an array with index ‘referer’.


Yes the new host runs Apache.
I am not sure why it uses this command. I am too new to PHP to really comment. Just trying to get a script working that work perfect on old host, also running apache. !?!


Instead of using $host[Referer], try using $_SERVER[‘REFERER’].


Hello, I have tried $_Server[‘Referer’] but nothing at all happens.

With $host[Referer] the email is sent but the field content is not passed.

When trying the new command on clicking Submit, the form just stays on the screen.


I’d say try some Debugging and tell us what happens then. $_SERVER[‘REFERER’] should have a value unless you have browser plugins that seriously mess up the server request.