Populating form fields from HTML emailer

I want to pass Vars from a mailer.. eg firstname, lastname and tel no etc -- so when the user clicks from mailer  thru to a form on our server, their details are allready populated in the form fields..

Is there a working example of this, or documentation anyone knows of?

I would imagine it would need to be passed via a string / URL and then parsed with PHP?  -- not really a coder, so wanted to ask you boffins if you could advise, or point me in a direction.

Working source example would be 1st prize :)

Thanks in advance,
Pixi.

Diana Diana, 7 years ago

Hi Pixi,

Are you looking to populate the form with your custom fields?

What you can do is basically something like:

http://www.mydomain.com/form?name=[firstname]&email=[email]etc

you just need to make sure the form fields (the name and email part) match up to your form field names and the tags or the actual detail you want populated it exactly what you want pre-populating those fields.


~*~~*~~*~~*~
D. Potter
Campaign Monitor
pixiwixi, 7 years ago

Hi Diana, thanks for your response.

I have tried a bout 10 different ways, but no joy.. can you look at my HTML mailer and form code and see if theres anything im doing wrong?

HTML MAILER Code:

<body>
<table width="551" border="0" cellpadding="3">
  <tr>
    <td bgcolor="#0099CC"><font size="4" face="Arial, Helvetica, sans-serif">This is a mailer</font></td>
  </tr>
  <tr>
    <td><p>Hi [firstname,fallback=]</p>
    <p>This is a test to see if we can populate your info into a form online.</p>
    <p><a href="http://www.mailgloo.com/technical_testing/populateForm/form.htm?name=[name]&email=[ikljyh-ikljyh]">click here to RSVP</a></p></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>

-----------------------------------------------------------

FORM CODE ..................

<body>
<form action="http://mailgloo2.createsend.com/t/y/s/ikljyh/" method="post">
<div>
<label for="name">Name:</label><br /><input type="text" name="cm-name" id="name" /><br />
<label for="ikljyh-ikljyh">Email:</label><br /><input type="text" name="cm-ikljyh-ikljyh" id="ikljyh-ikljyh" /><br />

<input type="submit" value="Subscribe" />
</div>
</form>
</body>

pixiwixi, 7 years ago

Just to re-iterate. - I am sending a mailer to user using CM. The mailer has Firstname, email and company.

when user clicks the " RSVP" link - it needs to somehow send firstname, email and company into the fields in my form online.

Pretty standard stuff.. but cant seem to get it to work?  Anyone got any ideas... See my code above.

Thanks,
Pixi.

Diana Diana, 7 years ago

Hey Pixi,

You've got some fields flipped there, you want to use the field name then = the custom field not the other way around.

Since even switching that around doesn't appear to be working though it's likely that you need some kind of scripting on the page. Since it's just plain HTML you'll generally need some kind of script like javascript (or PHP or something like that) to enable the prefilling, normally with a lot of CRM type systems it works fine because there is already script to enable it but you're not using one. There is an example here that might work and a Google search should turn up some others.


~*~~*~~*~~*~
D. Potter
Campaign Monitor
pixiwixi, 7 years ago

Populating form-fields from HTML emailer: SOLUTION:

Hi all, after 2 weeks finally managed to find a solution to this. I thought I would share:

1.    Need to have a list with custom fields:  ( Eg: Name, email, company, dog ) – Add this to Excel doc and upload to CM
2.    Go to ‘Manage subscribers’  - select your list and click ‘custom fields’  you will see something like the following:
Name [fullname,fallback=]
[firstname,fallback=]
[lastname,fallback=]
Email Address [email]dog  [dog,fallback=]
company [company,fallback=]
These are the field descriptors you will need later. Copy them somewhere.

3.    Next create a mailer in HTML and load it as a new campaign: Eg:

<table width="551" border="0" cellpadding="3">
  <tr>
    <td bgcolor="#0099CC"><font size="4" face="Arial, Helvetica, sans-serif">This is a mailer</font></td>
  </tr>
  <tr>
    <td><p>Hi [firstname,fallback=]</p>
    <p>This is a test to see if we can populate your info into a form online.</p>
    <p><a href="http://www.mydomain.com/form.htm?name=[firstname,fallback=]&email=[email]&company=[company,fallback=]&dog=[dog,fallback=]">click here to RSVP</a></p></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

Now the highlighted red area is what we require: This is a string we create on a link to pass custom fields to a URL. Once we get this to show values in the browser address bar, we can use a javascript to pass them to the form and populate the fields.

<a href="http://www.mydomain.com/form.htm?name=[firstname,fallback=]&email=[email]&company=[company,fallback=]&dog=[dog,fallback=]">click here to RSVP</a>

name=[firstname,fallback=]  Takes name from the fallback in the mailer
&email=[email]Takes email  from the fallback in the mailer
&company=[company,fallback] Takes company from the fallback in the mailer
&dog=[dog,fallback=] Takes dog / any custom field  from the fallback in the mailer

4.    Send the mailer using CM as a test..  if you click on the link in the mailer it should populate the addressbar with something like...
http://mydomain.com/form.htm?name=Jack&email=jack@myemailaddress.com&company=mycompanyname&dog=rover

5.    Now that we have the fields in the address bar we can use a javascript to run through the HTML and populate the form fields for us. Get the javascript here: http://www.willmaster.com/blog/javascript/pre-fill-form.php

Creating the form:
Create a subscribe form in CM: something like

<form action="http://mydomain.createsend.com/t/y/s/ikljyh/" name="MyForm" method="post">
<div>
<label for="name">Name:</label><br /><input type="text" name="cm-name" id="name" /><br />
<label for="ikljyh-ikljyh">Email:</label><br /><input type="text" name="email" id="ikljyh-ikljyh" />
<br />
<label for="dog">dog:</label><br /><input type="text" name="cm-f-jlbil" id="dog" /><br />
<label for="company">company:</label><br /><input type="text" name="cm-f-jlbir" id="company" /><br />

<input type="submit" value="Subscribe" />
</div>
</form>

NB – email fallback has a weird name, so we need to rename the ID in the form to the ID from the supplied form code supplied by CM.

Eg .. <input type="text" name="cm-ikljyh-ikljyh" id="ikljyh-ikljyh" />  <---- replace the name, so it reads name="email"

So the email tag now looks like this...
<label for="ikljyh-ikljyh">Email:</label><br /><input type="text" name="email" id="ikljyh-ikljyh" />

-------------------------------- 

The mailer should now open your form page and have your values in the header addressbar, and the javascript should pull the variables into your form and prepoulate all the customfield values..

Schew.!

All should work perfectly now.  Hope this helps someone.
Pixi

PS - Huge thankyou to Diana from CM for all the help. much appreciated.

Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098