45 users online (0 members and 45 guests)  


  Results 1 to 6 of 6

Related

  1. Populating Form Field from URL    Forum: HTML Forum
    Replies: 0
  2. Variable in Form action field    Forum: Javascript Forum
    Replies: 4
  3. Pass Form Checkbox Value on Click    Forum: Javascript Forum
    Replies: 1
  4. How to pass an array through a form?    Forum: CGI Perl Forum
    Replies: 1
  5. FROM: field in form    Forum: Website Scripts Forum
    Replies: 4
  1. #1
    andrewatx's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2004
    Posts
    3

    Pass a value from a url string to a form field

    How can I pass information such as an afilliate id to a form hidden field when the ID is passed on the URL such as
    http://domain.com/formname.html?IDValue

    Hidden field name = DEMO1 to receive the value supplied by IDValue from the URL String.

    Thanks
    Andrewatx

  2. #2
    dlongnecker's Avatar
    Tired Student...(Z_z)

    Status
    Offline
    Join Date
    Aug 2004
    Location
    Wichita, KS
    Posts
    86
    Okay, I think I'm reading your question right; let me restate your question and my assumptions.

    I assume you are using ASP/VB'ish writing... I'd have to do a bit of PHP homework if you're using that (or I'm sure someone can help out there).

    You have a variable in your URL:

    http://www.url.com/page.asp?var=boogabooga

    You want to pull that variable into an ASP variable, such as. The most simplistic way would be to:

    HTML Code:
    Dim strMyVar ' For your variable
    strMyVar = Request.QueryString("var")
    response.write(strMyVar) ' To test your variable
    From there, once it's a variable, you can go crazy and apply case statements, etc.

    If you have multiple vars, you can parse them out by each Request.QueryString("varname").

    Good links:

    A decent Microsoft TechNet article on keeping persistant information:
    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q300/5/05.ASP&NoWebContent=1

    ASP-Help.com's information:
    http://www.asp-help.com/objects/intr53hj.asp

    ASP Alliance showing ASP.NET and C#.
    http://authors.aspalliance.com/aspxtreme/sys/web/httprequestclassquerystring.aspx

    Hope these help!

    -David

  3. #3
    andrewatx's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2004
    Posts
    3

    not using asp

    I'd like to do this with simple html or at most javascript. I need a way without MS tech.

  4. #4
    dlongnecker's Avatar
    Tired Student...(Z_z)

    Status
    Offline
    Join Date
    Aug 2004
    Location
    Wichita, KS
    Posts
    86
    Here's a sorta messy way to do it with JavaScript.

    http://www.htmlgoodies.com/beyond/jspass.html

    Basically, drilling down in the previous form with JavaScript to put them in the address bar (might not be needed depending on your coding) and then creating functions to find the position of the text, capture it, and document.write it back. The more I read it... the messier it looks, but it'd get you away from a ASP-based solution.

    A good primer for JavaScript cookies can be found at http://www.webreference.com/js/column8/

    Second, you could use JavaScript and just set session cookies and have them expire immediately... that'd give you consistancy. To my knowledge, plain HTML is unable to communicate with the actual session variables--it's unaware of anything besides that which it is rendering (e.g. the heirarchy of the objects and classes of the browser and session).

    Hope that helps!

    -David

  5. #5
    andrewatx's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2004
    Posts
    3

    Can you suggest a good Cookie Reference?

    This is the first time I have ever played with cookes. Any suggestions for a good reference?
    aa

  6. #6
    dlongnecker's Avatar
    Tired Student...(Z_z)

    Status
    Offline
    Join Date
    Aug 2004
    Location
    Wichita, KS
    Posts
    86
    Yeah, that primer I posted in the previous post is a good place to start--good introduction.

    Thanks!

    -David



Tags for this Thread