...

View Full Version : loadwindow() - passing form variables



Taylor_1978
06-21-2004, 03:12 PM
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! :thumbsup:

Taylor.

Willy Duitt
06-21-2004, 05:18 PM
It may be easier to spot if we can see the rendered page codes.

glenngv
06-22-2004, 03:41 AM
<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>";
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum