Include information from a previous webpage on a contact form

I’m trying to figure out how I can include information from a previous webpage on a contact form, the site is running WordPress. Here is my scenario:

  1. I have an image gallery and a button on each image, below the image caption.
  2. This button links to a webpage with a contact form where a user fills in a few choices about the image.
  3. This form is then emailed to the website owner.

How can I include the image caption from step 1 in the contact form?

Related posts

Leave a Reply

2 comments

  1. HTML / HTTP is stateless. In your case, use something like sessions, cookies or GET / POST variables. Sessions and cookies are quite easy to use, with session being by far more secure than cookies. More secure, but not completely secure. Sessions store variables on the server where as the cookies get stored in the client side.

    Session

    //On page 1
    $_SESSION['varname'] = $var_value;
    
    //On page 2
    $var_value = $_SESSION['varname'];
    

    Cookies

    //One page 1
    $_COOKIE['varname'] = $var_value;
    
    //On page 2
    $var_value = $_COOKIE['varname'];
    

    You can also use get GET/POST variables. For example, you can store the image caption variable on page 1, append it to the appropriate URL and then retrieve it on page 2.