<p>I'd start by reading the "<a href="https://github.com/pixelandtonic/ContactForm#adding-additional-fields" rel="nofollow">Adding Additional Fields</a>" part of the docs. ;)</p>

CC BY-SA 3.0
2015-01-16T21:42:59.050Z
I've read the "Adding Additional Fields" and they don't appear on my email.  The only fields that are on my email are: email and message.

Also, to add: I have message[phone] and message[company] on my form, but they don't submit to my email.
Zachary
CC BY-SA 3.0
2015-01-16T22:22:03.337Z
Can you edit your original question and include the email form HTML?
Brad Bell
CC BY-SA 3.0
2015-01-16T22:35:13.190Z
Wait... so you're modifying the plugin's PHP code? If you follow the directions I linked to, that won't be necessary.
Brad Bell
CC BY-SA 3.0
2015-01-16T22:42:48.923Z
Without, the only fields that are displayed is name, email and message.  I must be missing something here.  I've also did a copy-and-paste of the instruction with the same results.
Zachary
CC BY-SA 3.0
2015-01-16T18:24:39.030Z
2015-01-16T18:24:39.030Z
Brad Bell
<p>I was having similar issues and was able to add some additional fields per the documentation Brad had mentioned. However, I found this <a href="https://github.com/craftcms/contact-form/issues/72" rel="nofollow noreferrer">post</a> and it helped me print out the name and email address into the body of the email. Hope this helps someone.</p>

CC BY-SA 3.0
2018-04-09T03:51:00.440Z
2018-04-09T03:51:00.440Z
Clint Hubbard Jr
<p>@Clint Hubbard jr If you need the email and the fromName in the html message body this can also be done without an extra plugin, using jQuery. Insert two extra hidden fields:</p>

<pre><code>&lt;input id="body_name"type="hidden" name="message[Name]" value=""&gt;
&lt;input id="body_email"type="hidden" name="message[Email]" value=""&gt;
</code></pre>

<p>Use the standard fields in the contact form:</p>

<pre><code>&lt;input id="fromName" type="text" name="fromName" required &gt;
&lt;input id="fromEmail" type="email" name="fromEmail" required &gt;
</code></pre>

<p>Then jQuery:</p>

<pre><code>&lt;script&gt;
$("#fromName").change(function() {
var myText = document.getElementById("fromName").value;
    $('#body_name').val(myText);
});
$("#fromEmail").change(function() {
    var myText = document.getElementById("fromEmail").value;
    $('#body_email').val(myText);
});
&lt;/script&gt;
</code></pre>

CC BY-SA 3.0
2018-04-09T07:49:23.957Z
2018-04-09T07:49:23.957Z
noregt
<p>I am a few years late, but I think your problem may be that you are labeling your message body with <code>name="message"</code>, instead of <code>name="message[body]"</code> as you should if you use custom fields. This way, you should not be coding PHP yourself.</p>

<p>Here is an example with a default field, a custom field and the message body field:</p>

<pre><code>&lt;input type="text" id="from-name" type="text" name="fromName" value="{{ message.fromName ?? '' }}"&gt;

&lt;input type="text" id="phone" type="tel" name="message[Phone]"&gt;

&lt;textarea id="message" name="message[body]"&gt;{{ message.message ?? '' }}&lt;/textarea&gt;
</code></pre>

CC BY-SA 4.0
2020-06-09T12:13:56.797Z
2020-06-09T12:13:56.797Z
Martijn Luyckx
<p>I'm working with the P&amp;T contact form plugin:
<a href="https://github.com/pixelandtonic/ContactForm" rel="nofollow">https://github.com/pixelandtonic/ContactForm</a></p>

<p>And I can't figure out how to add additional fields to my email, where do I add the additional field to the email template?</p>

<p>Thanks is advance.</p>

<p>MORE INFO:</p>

<p>Error Message:</p>

<pre><code>Internal Server Error
Property "Craft\ContactFormModel.company" is not defined.
</code></pre>

<p>HTML Email Form:</p>

<pre><code>$email-&gt;body = "Your Name: ".$message-&gt;fromName."\n\nCompany:\n\n".$message-&gt;company."Email Address: ".$message-&gt;fromEmail."\n\nPhone Number: ".$message-&gt;phone."\n\nRequests: ".$message-&gt;message;
</code></pre>

<plugin-contactform>
Adding additional custom fields to Contact Form Plugin from Pixel & Tonic
# Adding additional custom fields to Contact Form Plugin from Pixel & Tonic

(Asked by: username_0 on 2015-01-16)

I'm working with the P&T contact form plugin:
https://github.com/pixelandtonic/ContactForm
And I can't figure out how to add additional fields to my email, where do I add the additional field to the email template?
Thanks is advance.
MORE INFO:
Error Message:
Internal Server Error
Property "Craft\ContactFormModel.company" is not defined.

HTML Email Form:
$email->body = "Your Name: ".$message->fromName."\n\nCompany:\n\n".$message->company."Email Address: ".$message->fromEmail."\n\nPhone Number: ".$message->phone."\n\nRequests: ".$message->message;

**Tags:** plugin-contactform


---

## 4 answers

### Answer by username_1 on 2015-01-16. Score: 2

I'd start by reading the "[Adding Additional Fields](https://github.com/pixelandtonic/ContactForm#adding-additional-fields)" part of the docs. ;)

> **Comments:**
> **username_0**: I've read the "Adding Additional Fields" and they don't appear on my email.  The only fields that are on my email are: email and message.  Also, to add: I have message[phone] and message[company] on my form, but they don't submit to my email.  
> **username_1**: Can you edit your original question and include the email form HTML?  
> **username_1**: Wait... so you're modifying the plugin's PHP code? If you follow the directions I linked to, that won't be necessary.  
> **username_0**: Without, the only fields that are displayed is name, email and message.  I must be missing something here.  I've also did a copy-and-paste of the instruction with the same results.  

---

### Answer by username_4 on 2020-06-09. Score: 1

I am a few years late, but I think your problem may be that you are labeling your message body with name="message", instead of name="message[body]" as you should if you use custom fields. This way, you should not be coding PHP yourself.
Here is an example with a default field, a custom field and the message body field:




{{ message.message ?? '' }}


---

### Answer by username_2 on 2018-04-09. Score: 0

I was having similar issues and was able to add some additional fields per the documentation Brad had mentioned. However, I found this [post](https://github.com/craftcms/contact-form/issues/72) and it helped me print out the name and email address into the body of the email. Hope this helps someone.


---

### Answer by username_3 on 2018-04-09. Score: 0

@Clint Hubbard jr If you need the email and the fromName in the html message body this can also be done without an extra plugin, using jQuery. Insert two extra hidden fields:



Use the standard fields in the contact form:



Then jQuery:


---

