/    Sign up×
Community /Pin to ProfileBookmark

Request two fields in mail fuction body

Hi there,

I am using the mail function to send an email from my website.

Is there a way of requesting two fields to be inserted into the body of the email?

I know that to request one field you use:
$message = $_REQUEST[“Field1”];

How can you request another field?

Thanks in advance.

Kind regards

Mike

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@jimr451Sep 28.2010 — Hi there,

I am using the mail function to send an email from my website.

Is there a way of requesting two fields to be inserted into the body of the email?

I know that to request one field you use:

$message = $_REQUEST["Field1"];

How can you request another field?

Thanks in advance.

Kind regards

Mike[/QUOTE]


Mike,

You can append fields like so:


[code=php]$message = $_REQUEST["Field1"];

$message .= $_REQUEST["Field2"];[/code]


hope that helps.

-Jim
Copy linkTweet thisAlerts:
@sss_1234authorSep 28.2010 — Hi Jim,

Thank you very much for your post. That one little . has cost me hours!!

Thanks again.

Kind regards

Mike
Copy linkTweet thisAlerts:
@BIOSTALLSep 28.2010 — Haha. I remember I was stuck on this for hours when I was first learning PHP. I was following a book and thought the full stop was actually a bit of dirt on the page so ignored it. How silly did I feel when I figured it out :-P

On a side note and as a bit of advice, getting values via the $_REQUEST method is generally not recommended as it is unsecure. Try using the correct method ($_POST or $_GET) instead.

All the best
×

Success!

Help @sss_1234 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...