This is a discussion on Mail Function & Multiple form fields within the PHP Language forums, part of the PHP Programming Forums category; I'm having some problems with a php mail form where I am wanting to send information from 10 form ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm having some problems with a php mail form where I am wanting to
send information from 10 form fields in a e-mail. the way I have it structured for the mail command is mail ($to,$subject,$message); where message is made up from the multiple fields from the form e.g $message = "Name: ".$strName."\r\n"; "Company: ".$strCompany."\r\n"; The e-mail is sent fine but it only gives me the persons name and not the extra fields. Can anyone point me in the right direction? thanks Stuart |
|
|||
|
stuart@sjgill.force9.net (SJG) pipotte et a dit :
> I'm having some problems with a php mail form where I am wanting to > send information from 10 form fields in a e-mail. the way I have it > structured for the mail command is > > mail ($to,$subject,$message); > > where message is made up from the multiple fields from the form e.g > > $message = "Name: ".$strName."\r\n"; > "Company: ".$strCompany."\r\n"; > > The e-mail is sent fine but it only gives me the persons name and not > the extra fields. > > Can anyone point me in the right direction? > "Name:" and "Company :" should be placed in the $additional_headers parameter. mail($to, $subject, $message, $additional_headers); -- Julien CROUZET aka c2c Promo 2007 > Et les news sont un coin sympa pour discuter, > un peu comme le cafe du coin Chichery Florent |
|
|||
|
SJG wrote:
> I'm having some problems with a php mail form where I am wanting to > send information from 10 form fields in a e-mail. the way I have it > structured for the mail command is > > mail ($to,$subject,$message); > > where message is made up from the multiple fields from the form e.g > > $message = "Name: ".$strName."\r\n"; > "Company: ".$strCompany."\r\n"; This line doesn't do anything! I think maybe you want: $message .= "Company: ".$strCompany."\r\n"; > The e-mail is sent fine but it only gives me the persons name and not > the extra fields. > > Can anyone point me in the right direction? You're not addind data to the $message variable. -- USENET would be a better place if everybody read: : mail address : http://www.catb.org/~esr/faqs/smart-questions.html : is valid for : http://www.netmeister.org/news/learn2quote2.html : "text/plain" : http://www.expita.com/nomime.html : to 10K bytes : |
|
|||
|
On 9 Jun 2004 01:13:22 -0700, stuart@sjgill.force9.net (SJG) wrote:
>$message = "Name: ".$strName."\r\n"; >"Company: ".$strCompany."\r\n"; you should use the point operator to concatenate the two together: $message = "Name: ".$strName."\r\n" . "Company: ".$strCompany."\r\n"; Feel free to use my contact form generator at: http://www.rent-a-tutor.com/tools/ to build an online form online. The PHP source will be sent to you via e-mail, so make sure you enter a valid mail address. After you received the code, you can check the source and find out how I have done it :-) Regards Marian -- http://www.heddesheimer.de mailto:marian@heddesheimer.de http://www.rent-a-tutor.com Software on the Web |
|
|||
|
While the city slept, SJG <stuart@sjgill.force9.net> feverishly typed:
> I'm having some problems with a php mail form where I am wanting to > send information from 10 form fields in a e-mail. the way I have it > structured for the mail command is > > mail ($to,$subject,$message); > > where message is made up from the multiple fields from the form e.g > > $message = "Name: ".$strName."\r\n"; > "Company: ".$strCompany."\r\n"; > > The e-mail is sent fine but it only gives me the persons name and not > the extra fields. The semicolons at the end of each line terminate the line of code, so you have a line of code that says $message = "Name: ".$strName."\r\n"; and another which is the rather mysterious "Company: ".$strCompany."\r\n"; (though I would expect you to be getting an error message for that line). As others have suggested, you can use $message = "Name: ".$strName."\r\n"."Company: ".$strCompany."\r\n"; or, $message = "Name: ".$strName."\r\n"; $message .= "Company: ".$strCompany."\r\n"; or you could use $message = "Name: $strName\r\n Company: $strCompany\r\n"; Hope that helps, Nige -- Nigel Moss. Email address is not valid. nigel@nigenetDOG.org.uk. Take the dog out! http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com In the land of the blind, the one-eyed man is very, very busy! |