Re: PHP form-to-email script

by "Darrell King" <darrell(at)webctr.com>

 Date:  Fri, 31 Oct 2003 06:53:20 -0500
 To:  "Christie Cooksey" <christie(at)thearmidalemall.com>
 Cc:  "HWG Techniques" <hwg-techniques(at)hwg.org>
 References:  aaron
  todo: View Thread, Original
Designing a PHP script yourself is very simple.  In the simplest scenario,
just as an example, you would send all fields as they arrive:

http://us2.php.net/manual/en/ref.mail.php
http://us2.php.net/manual/en/function.mail.php

START PASTE BELOW
<?php
// Put this above the opening html tag.
$note = '';
if ($_POST['submission'] == TRUE) {
foreach ($_POST as $fieldname => $value) {
 $note .= "$fieldname: $value\n";
}

mail(
 'christie(at)thearmidalemall.com',
 'A Form Submission',
 $note,
 "From: {$_POST['email_address']}\r\n"
);

}
?>

END PASTE ABOVE

<!-- put form in the body tag -->

<form method='post' action='<?=$_SERVER['PHP_SELF']?>'>
 <input type='hidden' name='submission' value='1' />
 <input type='text' name='email_address'
value='<?=$_POST['email_address']?>' /><br />
 <textarea name='message'><?=$_POST['message']?></textarea><br />
 <input type='submit' name='whatever' value='Submit' />
</form>





Of course, there is far more you can add to it, such as email address
checking (http://us2.php.net/manual/en/function.checkdnsrr.php), validation
by field, multiple recipients for To, Cc or Bcc, database archiving,
autoresponders.  I've done a bunch of them for many different needs and you
can feel free to send quesiotns off-list if you decide to tackle it.

PHP is very cool....:).

D



----- Original Message -----
From: "Christie Cooksey" <christie(at)thearmidalemall.com>



I'm trying to get "Jack's Formmail" to work and can't.

I need something to email the results of a form.

Does anyone have a favourite php script they would recommend?

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.