We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Contact form question

How Do I?

ottercreate's avatar
ottercreate
15 posts
4 years ago
ottercreate's avatar ottercreate

How do I add a custom field (phone number) to the default email contact form in EE and have it included in the notification email that is sent from the form?

       
Rob Allen's avatar
Rob Allen
3,114 posts
4 years ago
Rob Allen's avatar Rob Allen

The trick is in naming the fields:

You have core fields for email, subject etc such as:

<label for="from">Email *</label>
<input type="email" id="from" name="from" value="" required>

<label for="subject">Subject *</label>
<input type="text" id="subject" name="subject" value="Contact Form">

Then for other fields you need to use name="message[]" for each input, examples:

<label for="message">Message *</label>
<textarea id="message" name="message[]" required></textarea>

<label for="cheese">Whats' your favourite cheese?</label>
<input type="hidden" name="message[]" value="---CHEESE---"> <!-- pass hidden input name to email -->
<input type="text" id="cheese" name="message[]" value="">

<label for="phone">Phone</label>
<input type="hidden" name="message[]" value="---PHONE---"> <!-- pass hidden input name to email -->
<input type="tel" id="phone" name="message[]" value="">
       
ottercreate's avatar
ottercreate
15 posts
4 years ago
ottercreate's avatar ottercreate

Worked like a charm, thank you.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.