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

    passing parameters between 2 web pages

    attached are 2 modules which are supposed to pass data between 2 web pages. The coding was supplied by to me by a web site and it does not work. I am not able to see why - can anyone help.
    First module which I call 'pass1.html'

    <html>
    <head>
    <title>pass</title>
    </head>
    <BODY>
    <center>
    <form type=get action="pass2.html">
    <table border=1>
    <tr>
    <td>First Name:</td>
    <td><input type=text name=firstname size=10></td>
    </tr>
    <tr>
    <td>Last Name:</td>
    <td><input type=text name=lastname size=10></td>
    </tr>
    <tr>
    <td>Age:</td>
    <td><input type=text name=age size=3></td>
    </tr>
    <tr>
    <td colspan=2><input type=submit value="Submit!">
    </td>
    </tr>
    </table>
    </form>
    </center>
    </body>
    </html>

    second module which I call 'pass2.html'

    <html>
    <head>
    <title>pass</title>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    <!-- Begin
    function getParams() {
    var idx = document.URL.indexOf('?');
    var params = new Array();
    if (idx != -1) {
    var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
    for (var i=0; i<pairs.length; i++) {
    nameVal = pairs[i].split('=');
    params[nameVal[0]] = nameVal[1];
    }
    }
    return params;
    }
    params = getParams();
    // End -->
    </script>
    </HEAD>
    <body>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    firstname = unescape(params["firstname"]);
    lastname = unescape(params["lastname"]);
    age = unescape(params["age"]);
    document.write("firstname = " + firstname + "<br>");
    document.write("lastname = " + lastname + "<br>");
    document.write("age = " + age + "<br>");
    // End -->
    </script>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Have a read of this example see if it helps

    http://www.huntingground.freeserve.c...a/formget1.htm
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.


  •  

    Posting Permissions

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