visitors name not displayed in mail after filling in mail form

This is a discussion on "visitors name not displayed in mail after filling in mail form" within the PHP Forum section. This forum, and the thread "visitors name not displayed in mail after filling in mail form are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Nov 16th, 2005, 17:57
New Member
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
visitors name not displayed in mail after filling in mail form

hi, I'm having a bit of a problem with my mail form. It works fine with a php script, but when I receive a mail of a visitor after filling in the mail form, I get from: anonymous @ hosting.name of server in the header of my mail. I would like to see the name and email displayed in the header but I can't figure out how.
my php-code looks like this:

PHP: Select all

<?php
 
$TextVariable 
'&resultaat=';
$response 'De data is verzonden.';
 
echo 
$TextVariable;
echo 
$response
 
$maat 
$_post['smaat'];
$naam $_post['snaam];
$adres = $_post['
sadres'];
$telefoon = $_post['
stelefoon'];
$email = $_post['
semail'];
$opmerking = $_post['
sopmerking];
 
mail (&quot;madeonearth@telenet.be&quot;, &quot;subject&quot;, &quot;
 
Maat$maat
Naam
$naam
Adres
$adres
Telefoon
$telefoon
Email
$email
Opmerking
$opmerking
&quot[IMG]http://www.flashmove.com/board/images/smilies/wink.gif[/IMG];
?>
so I tried something else, this time with a header, the code go's like this:

PHP: Select all

<?php
$to 
= &quot;madeonearth@telenet.be&quot;;
$subject = &quot;the subject of the mail&quot;;
 
$message $_POST['bericht'] ;
$header = &quot;From: &quot;. $_POST['naam'] . &quot;<&quot; . $_POST['emailadres'] . &quot;>n&quot;;
$header .= &quot;Reply-To: &quot; . $_POST['naam'] . &quot;<&quot; . $_POST['emailadres'] . &quot;>n&quot;;
$header .= &quot;X-Priority1&quot;;
mail ($to$subject$bericht$header);
?>
This code workes fine and displayed the name and email in de From-header. However, I can't imply my var's of previous code (php-code 1, the one above), like adres and phone.
I've divined them as $adres = $_POST['sadres'];
$telefoon = $_POST['stelefoon']; and so on, and placed them in mail($to, $subject, $bericht, $adres, $telefoon, $header); but when I do that I get again anonymous @ hosting.my server. So why does he do it right if I only place mail ($to, $subject, $bericht, $header); and not when I put in $adres and $telefoon?

can someone help me out with this?
eternally grateful

Last edited by Rob; Nov 16th, 2005 at 18:45. Reason: WHEN POSTING CODE, PLEASE USE [PHP] TAGS TO SURROUND PHP CODE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 16th, 2005, 21:22
New Member
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: visitors name not displayed in mail after filling in mail form

I found it! Just had to put my var's in a $message
so the correct code go's like this

PHP: Select all

<?php

$TextVariable 
'&resultaat=';
$response 'De data is verzonden.';

echo 
$TextVariable;
echo 
$response;

$maat $_POST['smaat'];
$naam $_POST['snaam'];
$adres =$_POST['sadres'];
$postbus $_POST['spostbus'];
$plaats $_POST['splaats'];
$telefoon $_POST['stelefoon'];
$email $_POST['semail'];
$opmerking $_POST['sopmerking'];
$to "madeonearth@telenet.be";
$subject "Results from online form";
$message "Maat: ".$maat."\nNaam: ".$naam."\nAdres: ".$adres."\nPostbus: ".$postbus."\nPlaats:".$plaats."\nTelefoon: ".$telefoon."\nEmail: ".$email."\nOpmerking :".$opmerking."\n";
$header "From: " $_POST['snaam'] . " <" $_POST['semail'] . ">\n";
$header .= "Reply-To: " $_POST['snaam'] . " <" $_POST['semail'] . ">\n";
$header .= "X-Priority: 1";
mail ($to$subject$message$header);

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 16th, 2005, 21:52
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,181
Blog Entries: 7
Thanks: 27
Thanked 21 Times in 18 Posts
Re: visitors name not displayed in mail after filling in mail form



Glad you got it sorted!
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 16th, 2005, 21:58
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: visitors name not displayed in mail after filling in mail form

I was actually gonna sort this put for you but you beat me to the punch
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 16th, 2005, 22:09
New Member
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: visitors name not displayed in mail after filling in mail form

Well, I do have an other question, I would also like an auto reply attached to it. But I have no clue where to start...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 16th, 2005, 22:25
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: visitors name not displayed in mail after filling in mail form

An auto reply to send back to the user?

If so then below the current form you need to make another mail fucntion this time switching the mail addresses with the message of thank you etc.

It would send the first mail then the second.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 16th, 2005, 22:29
New Member
Join Date: Nov 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: visitors name not displayed in mail after filling in mail form

Found and tested this one, and it works! Just paste this behind the rest of your php-code

PHP: Select all

// Reply
// ---------------------------


$subject "Bedankt voor uw bestelling.";


$headers "From: MyName<madeonearth@telenet.be>\n";
$headers .= "X-Sender: <madeonearth@telenet.be>\n";
$headers .= "X-Mailer: PHP\n"// mailer
$headers .= "X-Priority: 1\n"// Urgent message!
$headers .= "Return-Path: MyName<madeonearth@telenet.be>\n";  // Return path for errors


$recipient $email;


$message "Thank you for contacting me. I have received your e-mail and will reply as soon as possible.";

mail($recipient$subject$message$headers);
?>

?> 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Nov 16th, 2005, 22:43
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: visitors name not displayed in mail after filling in mail form

Yep, just a standard mail function
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
visitors, name, displayed, mail, filling, form

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Form help! ClrWtrDsgnr PHP Forum 6 Sep 27th, 2007 21:22
PHP Form Mail Maverick25r PHP Forum 2 Sep 22nd, 2006 21:59
Can someone help me with this e-mail form??? johnson8707 JavaScript Forum 9 Jul 5th, 2006 22:23
Can someone help me with this e-mail form??? johnson8707 PHP Forum 4 Jul 4th, 2006 17:51
E-mail form ??????? pittypatter Web Page Design 3 Apr 11th, 2005 23:42


All times are GMT. The time now is 20:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42