• I have two page. In first page – a simple form with three input text fields. And i want the values of these fields into another page with the same values of the form. The first page form is

    <form name="parameters" method="GET" action="second-page-url">
          <p> Login:
            <input type="text" name="login" value="">
          </p>
          <p> Password:
            <input type="text" name="password" value="">
          </p>
    	  <p> Email:
            <input type="text" name="email" value="">
          </p>
    	<p>
            <input type="submit" name="submit" value="Send data">
          </p>
        </form>

    And for Second Page – the form is

    <h2>Received: </h2>
    <form name="parameters" method="GET" action="">
    <fieldset>
          <p> Login:
            <input type="text" name="login" value="" id="login">
          </p>
          <p> Password:
            <input type="text" name="password" value="" id="password" readonly>
          </p>
    	  <p> Email:
            <input type="text" name="email" value="" id="email" readonly>
          </p>
         </fieldset>
        </form>

    and below this form I used the javascript code to get the values of the first page’s form into the second page form.

    <script language="JavaScript">
    
    		var parameters = location.search.substring(1).split("&");
    
    		var temp = parameters[0].split("=");
    		l = unescape(temp[1]);
    
    		temp = parameters[1].split("=");
    		c = unescape(temp[1]);
    
    		temp = parameters[2].split("=");
    		e =  unescape(temp[1]);
    
    		temp = parameters[3].split("=");
    		p =  unescape(temp[1]);
    
    		document.getElementById("login").value = l;
    		document.getElementById("password").value = c;
    		document.getElementById("email").value = e;
    
    </script>

    Please help – Or how it can be achieved?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add javascript into specific posts/pages ??’ is closed to new replies.