This might sound crazy, but if you have two form variables being passed in a php script when the form is submitted, why don't you join the variables in the PHP script? ie: $name = $_POST['fname'].$_POST['lname'];
Thank you for your suggestion.
I tried it:
$reply_to_name = $_POST['P_FNAME'].' '.$_POST['P_LNAME'];
[I tried it with the .' '. in the middle to separate the first and last names
and I tried it without the ' '. - no luck...]
All I got was the email address (no name).
NOTE-both 'P_FNAME' and 'P_LNAME' display in the body of the resulting email as expected,
but not in the head (from Joe Blowemail@example.com-
[I used '-' above instead of the greater than/less than signs so it would display here.]
1 person found this helpful
The code should have been written the way I had it:
$name = $_POST['fname'].$_POST['lname'];
To clarify this, the $_POST designates the method, so if your form method is get, you have to replace it with $_GET and the ['fname'] is ['var'] so the name has to match the name of the field.
If you post more of your code I could try to help you get the issue resolved but with the bit you posted I don't really have much more to suggest.
(Thank you SnakEyez02 for offering to help...)
This is in a form called form3.php:
The form now contains the following INPUT fields:
<INPUT name="P_FNAME" type="text" class="formtext" size="20" maxlength="20">
<INPUT name="P_LNAME" type="text" class="formtext" size="25" maxlength="25">
<INPUT name="P_EMAIL" type="text" class="formtext" size="50" maxlength="240">
The formmail.php script contains the following required variables:
$reply_to_name = $_POST['P_FNAME'].$_POST['P_LNAME'];/*Doesn't work*/
I believe that's faithful to your recommendation...
The resulting email contains the correct email address of the submitter, but NOT the name...
I also tried replacing the single quotes ' with double quotes " - same result.
What I've read on the net, etc., suggest to me that it should work!
Can't figure out why it doesn't...
Ideally, they first name and the last name would be separated by a space [.' '.]
I'm using DBmasters-FormMailer: