Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP mail $headers from input fields?
Old 12-14-2010, 04:38 PM PHP mail $headers from input fields?
Average Talker

Posts: 19
Trades: 0
I have an email form that is sending to an email address. There are five fields where the person sending can input their Name, Address, City, State, and Zip. Everything is working, except I want the input from these fields to be the the headers in the PHP email.

For instance it submits and send the letter, but I want the senders Name, Address, City, State, and Zip to be posted after the "Sincerely" in the letter sent. Here is what the input boxes of the form looks like:

Code:
<p>Sincerely,<br /> 
<label for="from">Name:</label>
<input type="text" name="from" id="from" value="<?php echo $_POST['from'];?>"/><br />
<label for="street">Street:</label>
<input type="text" name="street" id="street" value="<?php echo $_POST['street'];?>"/><br />
<label for="city">City:</label>
<input type="text" name="city" id="city" value="<?php echo $_POST['city'];?>"/><br />
<label for="zip">Zip:</label>
<input type="text" name="zip" id="zip" value="<?php echo $_POST['zip'];?>"/><br />
<label for="email">E-mail:</label>
<input type="text" name="email" id="email" value="<?php echo $_POST['email'];?>"/></p>
<input type="submit" class="button" value="Submit" />
I want to post the value of the input boxes here to print out in the email sent. How do I script the "$headers" to insert the values from the input boxes in the form?

Here is what the header looks like. How to I get the the "from" value in the form to post in the email? I am unsure of the syntax.

Code:
 $headers = "From:         ";
I need to enter something after the "From:" above. Any ideas?
lazerbrains is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-15-2010, 12:48 PM Re: PHP mail $headers from input fields?
Experienced Talker

Posts: 43
Trades: 0
Try:
Code:
$headers =  "From: " .$_POST['from']. "<".$_POST['email'].">"."\n";
That should work.
TheSir is offline
Reply With Quote
View Public Profile
 
Old 12-20-2010, 10:18 PM Re: PHP mail $headers from input fields?
Average Talker

Posts: 19
Trades: 0
Quote:
Originally Posted by TheSir View Post
Try:
Code:
$headers =  "From: " .$_POST['from']. "<".$_POST['email'].">"."\n";
That should work.

Thank You!!! That did the trick!!
lazerbrains is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP mail $headers from input fields?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11585 seconds with 12 queries