PDA

View Full Version : Sending web based form to email


tommy
02-15-2004, 11:45 AM
I need a bit of help I have taken over a site that a friend started. The site is on a Linux server so I would imagine that I would have to use PHP or CGI to send a form to a email address.

The thing is I have no PHP or CGI experience all my experience is MS based so I was wondering if some one could point me in the right direction on how to send a web based form to a email address. The form you will find at directory form (http://www.inneedof.co.uk/suggest.html)

Thanks in advance

Tom

DxRob
02-18-2004, 03:23 AM
Well, you could write a form2email script yourself, but as you have already said you dont have much experience in php your best bet would be to download a form processor.

Here's a link to a good form2email processor:

Matt's Formmail Script (http://www.scriptarchive.com/formmail.html)

Or, if you really wanted to have a go at writing your own, here's a link to the "mail" function in the php manual:

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

Usage of the mail function is quite simple.

Basically, you'd need to pass the form data to the script in POST format. The data can then be accessed in the script with the POST array:

$_POST['input_name']

Where input_name corresponds to the name of the input field in your html file, for example:

<input name="email" type="text">

becomes

$_POST['email']

in the script.

You'd then have to pass this data to the mail function, and it's then emailed to you.

Hope that helps.