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
    Regular Coder
    Join Date
    Jun 2003
    Location
    Australia
    Posts
    528
    Thanks
    8
    Thanked 8 Times in 8 Posts

    loadwindow() - passing form variables

    Hiya...

    This is the code I am using:

    <SCRIPT LANGUAGE="JavaScript">
    function loadwindow() {
    window.open("report.php","","width=400,height=300")
    }
    </script>

    <body bgcolor=#006699 topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0>

    <? include ("connect.php");
    echo "<center>

    <form method=post target=_new style='margin: 0px; 0px; 0px; 0px'>

    <SELECT style='margin: 0px; 0px; 0px; 0px' NAME=opponent style='width: 500px; height: 120px' multiple>";
    $result = mysql_db_query(ysl, "SELECT * FROM roomusers WHERE abrv='$abrv' ORDER BY username");
    while ($row = mysql_fetch_array($result)) {
    $c_uid = $row["uid"];
    $username = $row["username"];
    $resulta = mysql_db_query(ysl, "SELECT * FROM stats WHERE uid='$c_uid' AND abrv='$abrv'");
    $rowa = mysql_fetch_array($resulta);
    $c_staff = $rowa["staff"];
    // Room Manager
    if ($c_staff == 6) {
    $color = "#990000";
    }
    // Assistant Room Manager
    if ($c_staff == 7) {
    $color = "purple";
    }
    // RoomOp
    if ($c_staff == 8) {
    $color = "#b8860b";
    }
    // Regular Member
    if ($c_staff == 0) {
    $color = "black";
    }
    if ($c_uid == $_SESSION[uid]) { $color = "blue"; }
    echo "<option value=$c_uid style='color:$color; font-weight: bold; font-family: arial; font-size: 8pt'>$username</option>";
    }

    echo "</select>
    <input type=submit onClick=\"loadwindow()\" name=submit value='Report Loss'></form>";
    ?>

    For some reason though the value of OPPONENT will not pass onto the new page report.php - any ideas as to why?

    Thanks in advance!

    Taylor.
    Last edited by Taylor_1978; 06-21-2004 at 03:14 PM.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It may be easier to spot if we can see the rendered page codes.

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,965
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Code:
    <script type="text/javascript">
    function loadwindow(url, target) {
       var w = window.open(url, target, "width=400,height=300");
       w.focus();
    }
    </script>
    ...
    <form method="post" action="report.php" target="_new" style="margin: 0px; 0px; 0px; 0px" onsubmit="loadwindow(this.action, this.target)">
    ...
    echo "</select><input type=\"submit\" name=\"submit\" value=\"Report Loss\"></form>";
    ?>


  •  

    Posting Permissions

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