473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Mail Function & Multiple form fields

SJG
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
Jul 17 '05 #1
4 8532
st****@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
Jul 17 '05 #2
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 :
Jul 17 '05 #3
On 9 Jun 2004 01:13:22 -0700, st****@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:ma****@heddesheimer.de
http://www.rent-a-tutor.com Software on the Web
Jul 17 '05 #4
While the city slept, SJG <st****@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. ni***@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!
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Web Master | last post by:
Hi, I am having a little issue with Jacks Form mail php script. I have installed it and configured the form to get it to work, but for some bizarre reason I have 2 issues I can't seem to debug....
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: cemcat | last post by:
Hello, We have an ASP.NET 2.0 (C#) web form that contains a textbox for users to enter multiple e-mail addresses separated by semicolons. We need to validate that each individual e-mail address...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
4
by: Ngoc | last post by:
I created a form, cabreg.asp, with a "Send" button and cdosys_form.asp script. However, I got the message "Page cannot be displayed" Please help and here are my files ---- CABREG.ASP ----- ...
1
by: mr k | last post by:
Hi, I wanted to use mail merge with forms but Text form fields are not retained during mail merge in Word, I got the code from Microsoft but it doesn't remember the text form field options such as...
3
uranuskid
by: uranuskid | last post by:
Hey folks, I was going to include a contact form on my website. Well, in the first place that seemed an easy thing to do with a form that prompts a PHP file validating the input vaiables and using...
1
by: maxxxxel | last post by:
Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send...
7
by: sbryguy | last post by:
Greetings, I'm pretty new at ASP/SQL so if this seems like a no brainer, please enlighten me. I have a form that is being used to track volunteer activities for employees in my company. The...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.