Php form processing help

Hi from sun going down fast in Wakefield UK…

I’m going through a tutorial about processing php forms and something puzzles me and its this. Whils i can nearly do a php script for a form how do make sure the content of the form arrives in a designated eMail address?

I noticed on a php script for a form has this in the beginning of the php script…
ini_set(“sendmail_from”, “user@yourdomain.com”);

if (empty($_SERVER[‘HTTP_REFERER’]) || (
(!strstr($_SERVER[‘HTTP_REFERER’], “http://dev.spookmedia.com/”)) &&
(!strstr($_SERVER[‘HTTP_REFERER’], “http://pause.zippy.sdev.net/”)) &&
(!strstr($_SERVER[‘HTTP_REFERER’], “http://www.pause.co.uk/”))&&
(!strstr($_SERVER[‘HTTP_REFERER’], “http://www.pauserefreshment.co.uk/”))&&
(!strstr($_SERVER[‘HTTP_REFERER’], “http://www.refreshments.co.uk/”))
))
{
header(“HTTP/1.0 404 Not Found”);
return;
}

So my question is do i get this stuff from the hosters of the site and add it to the php form script.

Thanks in advance,
David

Hey!

So, is your question…

how do make sure the content of the form arrives in a designated eMail address?

Well, you specify the recipient in your PHP script. This should always be hard-coded by yourself.

Or…

do i get this stuff from the hosters of the site and add it to the php form script.

Trickier, which ‘stuff’ do you mean? :wink:

?

The code you include doesn’t seem directly related to sending email, but here’s how to send email from PHP.

http://www.php.net/manual/en/function.mail.php

The function works with no trouble on hosted sites that offer basic php and mail services. Somehow the function, which executes on your host’s servers, interfaces with your host’s SendMail (or whatever they use). You may not even have to set the “from” address if your host has done that for you already.

However, if you’re running php on your own computer, the function won’t work because you don’t have a mail server also running, and if you did, your host probably doesn’t let you use port 25.

I hope that helps. :wink: