Jump to content

Recommended Posts

This PHP script work exactly as it should sending the email to the appropriate email address defined in it and displaying the correct web page upon a successful submit. Right now if I go throught the process the email sent is from oceans@aimtree.org and it is sent to oceans@aimtree.org. I would like to know if someone can help me with resolving where the from is being pulled from. At the bottom of my form I have a required field for contact information in the form of an email address. I would like that field to somehow display that it is from that entry this way when the user oceans@aimtree.org receives the email they can know who it is from and reply back to it. I don't know what code is needed if any at all to make this happen. I hope this makes sense to all of you. Thanking you in advance
Here is the script

<?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 = 'oceans@aimtree.org';

// Where to redirect after form is processed.
$url = 'http://www.aimtree.org/pwthankyou.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.'">';
?>
Link to comment
https://forums.phpfreaks.com/topic/9923-php-script-code/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.