/    Sign up×
Community /Pin to ProfileBookmark

how2 modify "from" field to reflect EMAIL in the form

I have this form from the internet,
how can I modify the part (i.e. what should I replace $SEND_email with) posted below so it reflects the email address the sender puts in the EMAIL field, and not the general [email][email protected][/email] ?? Everything I try results in [b]parse error, unexpected T_STRING [/b] message

here is the snip – help is appreciated, as always!

[code=php]/* sendmail */

if (! $ccto) {
$header = “From: $SEND_emailrnReply-to: $SEND_email”;
}else{
$header = “From: $SEND_emailrnReply-to: $SEND_emailrnCc: $ccto”;
}

mail($sendto, $_POST{“subject”}, $SEND_prnt, $header);

/* END sendmail */[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@aoeguySep 16.2004 — You need to split the variable from the rest of the code.

do it like this:

[code=php]/* sendmail */


if (! $ccto) {
$header = "From: ".$SEND_email."rnReply-to: ".$SEND_email;
}else{
$header = "From: ".$SEND_email."rnReply-to: ".$SEND_email."rnCc: $ccto";
}


mail($sendto, $_POST{"subject"}, $SEND_prnt, $header);

/* END sendmail */[/code]



If you don't, PHP "thinks" that the variable is $SEND_emailrnReply-to: and not only $SEND_email

hope this helps,

aoeguy
Copy linkTweet thisAlerts:
@DariaauthorSep 16.2004 — sorry, it doesn't help ? still get [email][email protected][/email] in the from field...
Copy linkTweet thisAlerts:
@NogDogSep 16.2004 — If the email form is using the Post method and the name of the field with the email address is "email", then:
[code=php]
/* sendmail */
$from = $_POST['email'];
if(! $ccto)
{
$header = "From: $fromrnReply-to: $from";
}
else
{
$header = "From: $fromrnReply-to: $fromrnCc: $ccto";
}
mail($sendto, $_POST{"subject"}, $SEND_prnt, $header);
/* END sendmail */
[/code]
Copy linkTweet thisAlerts:
@DariaauthorSep 18.2004 — perfect! thank you ?
×

Success!

Help @Daria 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...