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:
- Install the Shortcode Exec PHP plugin.
- Install the OptimizePress 2 Theme or Plugin
- Be using Office Autopilot / Sendpepper or Ontraport for this particular example.
- Create your OptimizePress 2 page where the hidden form will reside
- Create a shortcode in WordPress by going to TOOLS > Shortcode Exec PHP
- Call the shortcode [get_email] and make the 1st line =echo($_GET[email]);
- Save the shortcode
- Create your Office Autopilot SmartForm as you normally do (see http://officeautopilot.zendesk.com if you need assistance).
- Copy the HTML of the form to a text editor
- 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=””/>
- In OptimizePress2 Live Editor you will ‘Add An Element’ for HTML
- Paste the code into the box and save.
- Save the page and visit the page, passing a variable in the url of the page like:email@example.com
- 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.