Passing variables via hidden form field?

Had a few questions recently about storing a value to be included in a subscribers details. For example, the page they arrived at “my” site from.

Is possible to have a hidden field in the phpList subscriber form?

This would make life so much simpler than delving into php coding.

You could put a hidden variable in the subscribe form, but I think that the issue you will run into is that phpList would need to know what to do with that.

Currently, you can setup an attribute and fill it in via the subscribe form, so you might want to experiment by setting up an attribute like “subscribed_from”, and set that as a hidden variable in your subscription form. (Look at Fname and Lname and email on an existing form to see how to do this).

If you want the value to be stored in a table differently than an attribute, then you will need to dive in to php…

Hello, i tried this method with this variable: i left out the starting and ending tag as they made the code disaper here.
input type=“hidden” name=“attribute49” size=“40” value="$referer isset($SERVER’HTTPREFERER’) $SERVER’HTTPREFERER’"

here is the info i got when subscrided:

subscribed_from = $referer isset($SERVER’HTTPREFERER’) $SERVER’HTTPREFERER’

Any ides on how to get it right?

you might want to hard code the value on the form.

that way when the form is submitted, it has the proper value showing where the subscription page it came from.

I am lost here,
do you have example of the code i need to put in the hidden field to catch HTTP REFERER?

Put this above the head:

    if (isset($_SERVER['HTTP_REFERER'])) {
        $referer = $_SERVER['HTTP_REFERER'];
    } else {
        $referer = "Twilight Zone";

Make your hidden field in the body like this:

<input type="hidden" name="attribute49" value="<?php echo "$referer";?>">

Worked perfectlty.

This is really a great place to get help.

1 Like