Form variables sent to a popup window

Discussion in 'HTML & Website Design' started by Submerged, Mar 7, 2008.

  1. #1
    I'm trying a three page system to check if a username has been registered already I'm having trouble on the second page, which is what I need help with. The code I have so far is:

    Page one (registration page):
    <head><script type="text/javascript">
    function myPopup() {
    window.open("checkusername.php", "popUp", "status = 1, height = 300, width = 300, resizable = 0" )}
    </script></head>
    <body>
    <p onClick="myPopup()">CLICK ME!</p>
    <form name=myform>
    <input name=username type=text value='hi!'>
    </form></body>
    Code (markup):
    Page 2 (checkusername.php) takes whatever is in the "username" input on the original page and puts it in the input on it's own page (also named "username").
    <head>
    <script>
    document.myform.username.value = opener.myform.username.value;
    </script>
    </head>
    
    <form name='myform' action='checkusername2.php' method='post'>
    <input type='text' name='username' value=''>
    </form>
    Code (markup):
    So far, the popup opens just fine and displays the username input, but the value doesn't transfer. Javascript is not my strong point, so any help would be awesome here :)

    -Submerged
     
    Submerged, Mar 7, 2008 IP