ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Can I add other fields to the Email Module form?

July 06, 2011 2:28pm

Subscribe [4]
  • #1 / Jul 06, 2011 2:28pm

    fanderson

    899 posts

    I have a very simple contact form with the following fields:

    Name, email, subject, message, submit

    Is it possible to add an additional field and have its value delivered with the email?

    I have tried and it ignores the additional field:

    <!-- CONTACT FORM -->
    {exp:email:contact_form id="contact-form" user_recipients="false" recipients="{embed:to}" charset="utf-8" return="{site_url}{embed:return}|Return to the Site"}{!--
    
    --}<label for="subject">Your Name:</label>
    
    <input type="text" id="name" name="name" size="40" value="" /></p>
    
    <label for="from">Your Email:</label>
    
    <input type="text" id="from" name="from" size="40" maxlength="35" value="" /></p>
    
    <label for="subject">Subject:</label>
    
    <input type="text" id="subject" name="subject" size="40" value="" /></p>
    
    {if segment_3 == "contact-us"}
    
    <label for="utility_co">Your Utility Company:</label>
    
    <input type="radio" name="utility_co"  value="company one" />Company One
    
    <input type="radio" name="utility_co" value="company two" />Company Two
    
    <input type="radio" name="utility_co" value="company three" />Company Three
    {/if}
    
    <label for="message">Message:</label>
    
    <textarea id="message" name="message" rows="18" style="width: 100%;"></textarea>
    
    {if captcha}
    Please enter the word you see in the image below:
    {captcha}
    
    <input type="text" name="captcha" value="" maxlength="20" /></p>
    {/if}
    
    <input name="submit" type='submit' value='Submit Form'></p>
    {/exp:email:contact_form}

    All the fields show properly, but the selected values do not come in the email. Any help would be appreciated.

  • #2 / Jul 06, 2011 8:33pm

    Rob Allen

    3114 posts

    You need to chnage the name values in all inputs other than name, email and subject.

    For example…

    <label for="utility_co">Your Utility Company:</label>
    
    <input type="radio" name="message[]"  value="company one" />Company One
    
    <input type="radio" name="message[]" value="company two" />Company Two
    
    <input type="radio" name="message[]" value="company three" />Company Three
    {/if}
    
    <label for="message">Message:</label>
    
    <textarea id="message" name="message[]" rows="18" style="width: 100%;"></textarea>
  • #3 / Jul 07, 2011 7:08am

    John Henry Donovan

    12339 posts

    Forrest,

    let us know if Rob’s advice helps

  • #4 / Jul 07, 2011 8:07am

    fanderson

    899 posts

    Hey BlueDreamer & John,

    Thanks for the useful advice. Problem solved.

    Forrest

  • #5 / Jul 07, 2011 11:50am

    Sue Crocker

    26054 posts

    Glad things are working for you, Forrest. If anything else comes up, please do let us know in a new thread..

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases