I was doing a survey on a page and needed to collect some data but didn’t want the user to enter their email address again.  By default you cannot run PHP code on WordPress posts and pages and need a plugin called Shortcode Exec PHP.  There are others but I found this to be easiest and did not cause any weirdness on the Optimize Press 2 pages.

What we are going to do is change a couple of variables on the HTML form that Ontraport gives us so that we can hide the email address.

Things You’ll Need:


  1. Create your OptimizePress 2 page where the hidden form will reside
  2. Create a shortcode in WordPress by going to TOOLS > Shortcode Exec PHP
  3. Call the shortcode [get_email] and make the 1st line =echo($_GET[email]);
  4. Save the shortcode
  5. Create your Office Autopilot SmartForm as you normally do (see http://officeautopilot.zendesk.com if you need assistance).
  6. Copy the HTML of the form to a text editor
  7. Change the line that looks like this:<input name=”email” type=”email” id=”mr-field-element-12345″ value=”” placeholder=””/>to this:<input name=”email” type=”hidden” id=”mr-field-element-12345″ value=[get_email] placeholder=””/>
  8. In OptimizePress2 Live Editor you will ‘Add An Element’ for HTML
  9. Paste the code into the box and save.
  10. Save the page and visit the page, passing a variable in the url of the page like:www.yoursite.com?email=whatever@email.com
  11. Now it will be grabbing that email from the URL and passing it in the form.

With this you can collect data on the user without requiring them to enter their email address again.

4 thoughts on “Get Email Variable From URL Into Hidden Field of Office Autopilot Form on Optimize Press 2”

  1. Thanks for the awesome step-by-step instructions Darren. This is a very handy way to further segment leads or customers by asking questions as they flow through your sales funnel.

  2. Pingback: Closed Loop Reporting (Sorta) with Ontraport | Darren Crawford.com

Leave a Comment

Your email address will not be published. Required fields are marked *