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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forwarding form results, please help...

    I'm very new to javascript, so I hope someone here will know the answer to this.

    I'm trying to create a mock-commercial site for a school project and I'm getting stuck on one point. I have a page with selection boxes which 'get' to a javascript to create a results page. On the result page it echos back the answers from the selection box and has the standard textboxes for the user to then enter name/address/creditcard information. That form forwards to a final page with displays the name/address stuff perfectly, but it just says undefined for the information that was passed from the first page to the second page.

    Is there a way to redeclare those values and forward them on to the last page with the new information?

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To be honest, I'm not even sure how you're passing the values from the first page to the second using Javascript! (Unless you're talking about server-side Javascript, so ASP...)

    If you've got two different pages, and you've got a form on the first and you post the form to the second page, that means you're sending the form variables to the server AND requesting the second page from the server.

    Since the form variables and the second page are on the server for a few moments, you'll need a server-side language to create a script to store those previous values onto this page. You can't use a client-side language as it's too late at that point.

    I've done exactly what you're talking about using PHP and the following script:
    http://www.zend.com/zend/spotlight/c...lery-wade7.php

    The only other way if you insist on using client-side Javascript is to combine the 3 pages into 1 page and separate the 3 pages into 3 DIVs and global variables to store the values. At first, only the first DIV would be visible, the other two hidden (using CSS). When they press the 'next' button, the first DIV would hide itself and the second DIV would become visible; and so on. This makes for uglier code, but it does the trick. There are other variations on this method, but that's the idea.

    Hope that helps,
    Sadiq.

  • #3
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi,

    The following:
    http://www.webxpertz.net/forums/faq....aq_wxfaq_1_1_2

    explains the various methods you can use to pass data from one page to another via javascript.

    If, after reading it, you still have trouble, post the relevant code.

    Vinny
    Where the world once stood
    the blades of grass
    cut me still


  •  

    Posting Permissions

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