Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Location
    Hot Springs Village, Arkansas
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question 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.

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,224
    Thanks
    10
    Thanked 269 Times in 268 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,
    Code:
    <form action="http://jimoberst.us5.list-manage.com/subscribe/post?u=86ed2ec7293230aec1b534e72" method="POST">
    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']

  • Users who have thanked tracknut for this post:

    joberst (06-18-2014)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •