Pass form variable from one web form to another

anthonytr
anthonytr used Ask the Experts™
on
Hi,

I have a very simple form on the frontend of a Drupal website.  The form simply asks for a users email address.  What I am trying to do is then navigate the user (when they press GO) to my 'contacts us' page with their email address already populated in the 'email address field'.

<form id="newsletterForm" action="http://mydomain/contact-us" method="POST">
	<div class="input-group">
		<input class="form-control" placeholder="Email Address" name="EmailAddress" id="EmailAddress" type="text">
		<span class="input-group-btn">
			<button class="btn btn-default" type="submit">Go!</button>
		</span>
	</div>
</form>

Open in new window


Currently, with the above code, when i press GO, nothing happens.  What am i doing wrong?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
In your controller for the contact page you need to look for the $_POST['EmailAddress'] variable and if it is present set the value of the contact us form to that value.

If you are using a plugin then the plugin would need to support this with a hook or a predefined variable name - if it does not provide support you will have to modify the plugin code or write your own handler for the contact page.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial