PDA

View Full Version : setting "from email address" to pull from form fie


lavans
05-18-2006, 02:02 PM
How do I adjust the PHP script to grab my form field called "email" and use that for the "From Email Address" that is sent using mailto form with the PHP script below -

<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Residential Repair Request';

// Your email address. This is where the form information will be sent.
$emailadd = 'fixitnow@repair.org';

// Where to redirect after form is processed.
$url = 'http://www.repair.org/thankyou.htm';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

HeadAche
05-25-2006, 07:23 PM
tiss tiss...

Creative Insanity
05-26-2006, 03:53 AM
http://dreamweaverclub.com/dreamweaver-php-form.php