Form to E-Mail...working, but...



Building a website for my local area of NA; & need lots of forms…learned form coding on my own…testing the site on one of my music site servers…my first form is basic, but covers all the info I need returned…(click on the ‘GROUP ANNIVERSARY FORM’ link…top right):

So…When info is entered in all fields; & the SUBMIT button is hit…the info is sent to my e-mail address; & the thank you page pops up. Trouble is, in the e-mail I receive…I’m only getting data from two fields…the ‘time’ of the anniversary and the ‘event description’, which are the last two fields.

Here is the form page code:

Burlington County Area of NA - Events5 body { background-image: url(SAM_5626-II.jpg); }
BURLINGTON COUNTY AREA of Narcotics Anonymous

Group Anniversary Form:

Home Group Name:

Home Group Address:

# of Years Celebrating:

Anniversary Day & Date:

Anniversary Time:

Briefly Decribe the Event:

Thank you!
[/php] ...& here is the PHP code: [php]<?php if(!isset($_POST['submit'])) { echo "error; you need to submit the form!"; } $message = $_POST['message']; $message = $_POST['message']; $name = $_POST['name']; $name = $_POST['name']; $name = $_POST['name']; $message = $_POST['message'];

echo “Home Group Name and all relative info is mandatory!”;

$email_from = ’ ';
$email_subject = “Events Page New Form Submission”;
$email_body = “You have received Events information from $name.\n”.
“Here is the message:\n $message”.

$to = "";
$headers = “From: $email_from \r\n”;
$headers .= “Reply-To: $visitor_email \r\n”;


header(‘Location: thank-you.html’);

function IsInjected($str)
$injections = array(’(\n+)’,
$inject = join(’|’, $injections);
$inject = “/$inject/i”;
return true;
return false;

<!doctype html>

Events - PHP [/php] can anyone please help?...(I've almost got this)...thanx,



You copied and pasted the form elements. So, you have multiple elements with the same name, “name”, resulting in the last value for it rather than all of those inputs.



thanx very much…!!!..& yes, I know. Also, the two message fields have the same names as well. I had thought that may be the problem, so I did try 7 different names (for the 7 different form fields), but it didn’t work because…not being a coder…I have no idea which part of the snippet to customize [& the informational I got the code from…(I think it was from LinkedIn) wasn’t specific as to how to exactly customize your own fields]. If you could just give me one ‘name’ example & one ‘message’ example, I would be eternally grateful.

thanx again,



You need to give the form fields sensible names.

[php] Home Group Name:


this could be called group_name instead (you can give it any name you want, just be consistent)

[php] Home Group Name:



Then you need to make the same change in the PHP code handling the form

$message = $_POST[‘message’];
$message = $_POST[‘message’];
$name = $_POST[‘name’];
$name = $_POST[‘name’];
$name = $_POST[‘name’];
$message = $_POST[‘message’];[/php]

$field1Name= $_POST[‘field1Name’];
$groupName= $_POST[‘group_name’];
$field3Name= $_POST[‘field3Name’];
$field4Name= $_POST[‘field4Name’];
$field5Name= $_POST[‘field5Name’];
$field6Name= $_POST[‘field6Name’];[/php]


You then need to combine the fields together into a message string that will make sense for you in an email

Note that in your current form handling you use name and email_from in the email to set the sender. You never get this data anywhere (you don’t even have name/email fields in your form)



THANX! (just got back here…sorry for the delayed response)