Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-11-2014, 09:15 PM #1
- Join Date
- Mar 2011
- Hot Springs Village, Arkansas
- Thanked 0 Times in 0 Posts
Passing a constant to an html page
I host a subscription form on my website for my email list (which is managed by MailChimp). On that form, I have a hidden variable that tells me where on the web the signup came from. To achieve this, I actually have many form pages, with a different source constant hard-coded into each form, and I link to a different form page from each web page where someone can click to sign up. Examples: https://www.facebook.com/photo.php?f...type=1&theater has one of these links that sends the subscriber to a particular form on Jim Oberst Fine Art Newsletter. The constant "fbpghdr" is hard-coded into the form as the hidden variable. This arrangement works, but it's awkward. Whenever I want to do something special to the form page, I have to do it to over a dozen of them. Here's an example of another of these pages: Jim Oberst Fine Art Newsletter.
Is there a way for me to just pass a constant in a "normal" html link, and then to plug this constant into the hidden variable field in the form? I see things that look like they're doing this in some urls after a "?", but I don't know how to actually implement this. I notice that there's one of these in the link above, but it's a .php, not a .html.
Thanks for any help you can give me.
06-11-2014, 10:31 PM #2
- Join Date
- Aug 2006
- Thanked 341 Times in 339 Posts
Presuming your "post" script is php, then sure, you can pass that (those) variables as part of the "query string" in the action. For example,
In post.php, rather than looking up the value of the hidden field "u", you'll find the value value in the variable $_GET['u']Code:<form action="http://jimoberst.us5.list-manage.com/subscribe/post?u=86ed2ec7293230aec1b534e72" method="POST">
Users who have thanked tracknut for this post: