Jump to content

Recommended Posts

Hi there, and please pardon the double post, but I got no replies in my other thread, and really need this fixed asap.

 

I set up a web page based on a template that included a contact form. The actual emailing of the form works great, but the email of the sender will always have their name and then cgi13.cgi13 after (example funlog@cgi13.cgi13). This means I don't have their proper address and cannot reply to them. I would appreciate any help I can get on this. Thanks in advance!

 

<?
// Get the variables from the form post
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$from = "From: $name\r\n";

// If there was no Subject submitted, set a default one here
if (!$subject) { $subject = "Message from Website"; }

// Check fields, if they're there, send the email; if not, display error page.
if ($name && $email && $message) {

// Put your email address in place of "email@business.com"
mail("email@business.com", $subject, $message, $from);

// Thank You Page
header("Location: ../contact-thankyou.html");
exit;

} else {

// Error Page
header("Location: ../contact-error.html");
exit;

}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/137852-contactphp/
Share on other sites

$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

$to = "your@email.adress.com";
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: $to\r\n";
$headers .= "From: $email\r\n";


// If there was no Subject submitted, set a default one here
if (!$subject) { $subject = "Message from Website"; }

// Check fields, if they're there, send the email; if not, display error page.
if ($name && $email && $message) {

   // Put your email address in place of "email@business.com"
   mail("email@business.com", $subject, $message, $headers);
   
   // Thank You Page
   header("Location: ../contact-thankyou.html");
   exit;
   
} else {

   // Error Page
   header("Location: ../contact-error.html");
   exit;
   
}
?>

i add heders, test your code one more time

Link to comment
https://forums.phpfreaks.com/topic/137852-contactphp/#findComment-720463
Share on other sites

Look at my sig the email code works properly.

 

The code provided below was help as you no, Then you alter to your likings.

 

Of course we can not do every think as requested for free.

 

All advance jobs use the freelance forum on here.

 

ps. if you dont understand the email function or no how it works read the manual please.

 

try changing the && to || ors

Link to comment
https://forums.phpfreaks.com/topic/137852-contactphp/#findComment-720625
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.