Jump to content

[SOLVED] PHP E-mail Form


harmanUK

Recommended Posts

Hello,

 

I have been trying to create a simple PHP e-mail form, the code i have at the moment is:

 

<?php 
{
$to = "[email protected]";
$company = "Matrix Electronics LTD"; 
$subject = "New Order Notification"; 
$thanks = "New Order Notification"; 
$headerclient = "Testing";
$name = $_POST['name']; 
$email = $_POST['e-mail']; 
$item1 = $_POST['item1'];   
$item2 = $_POST['item2'];
$item3 = $_POST['item3'];
  
$body = "You have a new order\n Name: <br>$name</br>\n E-mail $email\n Item 1: $item1\n Item 2: $item2\n Item 3: $item3"; 
$bodyclient = "Thank you for your order <br>$name</br>\n\n You have ordered:\n Item 1: $item1\n Item 2: $item2\n Item 3: $item3\n Thank you for shopping at $company !";   

echo "Thank you $name_field, your order has been received at $company! You will receive a confirmation e-mail to $email shortly. "; 
mail($to, $subject, $body, $headerclient); 
mail($email, $thanks, $bodyclient, $headerclient); 
} 
?> 

 

It works and sends the e-mail's but how to i define who it is from, at the moment when i receive the e-mail its from [email protected]. How can i change that to the company name?

 

Thanks,

Terry

Link to comment
https://forums.phpfreaks.com/topic/132771-solved-php-e-mail-form/
Share on other sites

Well when you send an email you have to specify certain headers, which is basically just a email form of a file's metadata... you mistakenly set yours to "testing" which is why I'm surprised it didn't get blocked as spam.

 

Try changing the value of your header variable from "testing" to whatever form matches what you want from my last post.

Thanks again for your quick reply, i have tried this and i dont think im doing something right, its appearing in the body of the message?

 

I have included a screenshot of the e-mail, with the red arrow pointing to what i want to be able to change.

 

 

http://img99.imageshack.us/my.php?image=helpps6.jpg

 

-Terry

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.