Title: Pre-Populated Fields?
Last modified: August 22, 2016

---

# Pre-Populated Fields?

 *  Resolved [wlb](https://wordpress.org/support/users/wlb/)
 * (@wlb)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/pre-populated-fields-1/)
 * Hello,
 * Is it possible to pre-populate the name and email address fields by passing them
   to the form in the URL?
 * I am sending out a confirmation email that will link to this form, but would 
   like to avoid forcing the user to type in their name and email again, when I 
   already have this information available.
 * Thanks in advance for any suggestions.
 * [https://wordpress.org/plugins/mailchimp-for-wp/](https://wordpress.org/plugins/mailchimp-for-wp/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [todc](https://wordpress.org/support/users/todc/)
 * (@todc)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/pre-populated-fields-1/#post-5265832)
 * This would be very useful and is supported by other form products.
 * Since I’m impatient, I tried to do it using PHP and got nowhere so I implemented
   it using jquery. From what I can tell most WordPress templates are using the 
   jquery javascript library these days so there’s a good chance it will work for
   you, but it does take a little technical prowess.
 * It seems to work great. If the URL parameters don’t exist you get the placeholder
   text.
 * Here’s a few assumptions you’ll need:
    - You know your way around WordPress and HTML. Strong coding skills not needed.
    - You can add javascript to the head of your pages, or alternatively into the
      page with the form. (I added it to my entire site, I’ll probably use it now
      that it’s working.)
    - You’re comfortable customizing the HTML hat makes up the MailChimp-for-WP 
      form(s).
 * There’s two steps:
 * **1. Add the javascript code that gets and parses the URL parameters.**
 * Get this javascript code from stackoverflow: [http://goo.gl/5DEPwU](http://goo.gl/5DEPwU)
   
   Put the code code in your template. My theme gives me a place to add javascript
   to the head for things like Google Analytics. This also is likely pretty common.
   You could put the code on just the page you need it, or I guess even in the form
   itself. I didn’t test these alternatives but it should work.
 * **2. Add the following code to the top of your MailChimp for WordPress form, 
   or somewhere else on the page.**
 *     ```
       <script>
       jQuery(document).ready(function($){
       $( "input[name*='FNAME']").val(GetURLParameter('firstname'));
       $( "input[name*='EMAIL']").val(GetURLParameter('email'));
       });
       </script>
       ```
   
 * Add, remove and modify the lines that start with $( as you need for your URL 
   parameters. FNAME and EMAIL are the names of the inputs in the form you want 
   to prefill. firstname and email are the URL parameters, you can rename them to
   whatever you want as long as you’re consistent.
 * The first line stumped me. I’m used to the standard jQuery **$( document ).ready(
   function() {… **, but this apparently needs to be modified for WordPress. I don’t
   get it but it works so I’m happy. I’m not a coder, maybe a hacker at best. I’ve
   tested in on recent (as of 10/30/14) versions of Chrome (38), FF (32), and IE
   11 and it seems to work great.
 *  [mother.of.code](https://wordpress.org/support/users/imazed/)
 * (@imazed)
 * The Mother of Code
 * [11 years, 2 months ago](https://wordpress.org/support/topic/pre-populated-fields-1/#post-5265860)
 * Hey guys. It’s been a while since this topic was opened but just to let you know,
   we now have easier ways of achieving this. Please check out our Knowledge Base
   pages:
    - [Populate fields with URL data](https://mc4wp.com/kb/populate-fields-url-data/)
    - [Add variables to redirect URL](https://mc4wp.com/kb/add-variables-to-redirect-url/)
 * Hope that helps. If not, make sure to let me know!
 *  [todc](https://wordpress.org/support/users/todc/)
 * (@todc)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/pre-populated-fields-1/#post-5265861)
 * iMazed, thanks for telling us about the update. Next time I edit my forms or 
   implement it for a client I’ll give it a try.
 * Dank je!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pre-Populated Fields?’ is closed to new replies.

 * ![](https://ps.w.org/mailchimp-for-wp/assets/icon-256x256.png?rev=1224577)
 * [MC4WP: Mailchimp for WordPress](https://wordpress.org/plugins/mailchimp-for-wp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-for-wp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-for-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-for-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-for-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-for-wp/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [todc](https://wordpress.org/support/users/todc/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/pre-populated-fields-1/#post-5265861)
 * Status: resolved