334 users online (0 members and 334 guests)  

  Results 1 to 3 of 3


  1. Mailto form, Subject with variables.    Forum: HTML Forum
    Replies: 0
  2. Passing Javascript variables to a form    Forum: Javascript Forum
    Replies: 0
  3. Replies: 2
  4. td { overflow: hidden; } ?    Forum: CSS Forum
    Replies: 10
  5. Replies: 10
  1. #1
    sumit israni's Avatar
    New User

    Join Date
    Jul 2001

    Hidden Form Variables(urgent Pls.)

    Hey Friends,
    Can anyone help me understand the significance of hidden variables in a form .What I am confused about is this :I understand that hidden variables can be used to track user sessions .But I dont understand how they can track user s preferences .If the user (client) is going to feed the information in a text area anyways then that information can go directly to the database and the server side program can handle about that particular session and identify it also .So why the big deal about hidden variables.Is it what I understand meant to simplify server side programming or database programming ?or is there any other "hidden" use associated with it!!!!???
    And hey Dean your reply would be heartily solicited as you had provided me a solution earlier!
    Also please let me know how to design a formwith hidden variables.

  2. #2
    Derek's Avatar
    Be Yourself

    Join Date
    Aug 2001
    St. George, Utah, USA

    this is why I need to learn php...

    so I can answer questions like these

    I'm workin on it!

  3. #3
    QuietDean's Avatar

    Join Date
    Oct 2000
    Bournemouth, UK

    Ah hah!

    Hi Sumit.

    First, making a hidden entry -

    <input type="hidden" name="secret" value="badger">
    As to the uses of hidden entries, they are many..

    Lets say your form action is process.php, or process.cgi.

    You are passing variables along in the form (like the senders name for instance). Normally, if you had any other variables, you would use a querystring, like process.php?wherefrom=myhomepage

    You can't do this with a posted form, so you pass it as a hidden input. When a form is posted, it's just passing variables. A hidden input is another variable.
    Another use, this is probably the 'tracking' bit you were talking about, is things like cookie information.

    Lets say my user has a cookie on his computer from my site, and this cookie is called 'beenbefore'. the value of the cookie is 'yes'. Because the guy has submitted data through my form before.

    So a bit of php to convert the cookie into a hidden input -

    PHP Code:


    "<input type=\"hidden\" name=\"beenbefore\" value=\"$cookie\">";

    So the output would be -

    <input type="hidden" name="beenbefore" value="yes">
    If he has been before. In this manner you can track someone through there form inputs, and tailor the process.php to react differently if he has been before.

    That help?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

Tags for this Thread