I have a php form that has a SELECT query that produces a variable I need for my popup which is being called from a javascript. Here is the code that I have in place today:
while($copy = mysql_fetch_array($results)) {
$variable1=$copy['BatchNum'];
$variable2=$copy['ProdNum'];
$variable3=$copy['Sku'];
$variable4=$copy['Type'];
$variable5=$copy['Model'];
$variable6=$copy['Qty'];
$variable7=$copy['ModelID'];
$variable8=$copy['RecvDate'];
//table layout for results
print ("<tr>");
print ("<td>$variable1</td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("<td>$variable5</td>");
print ("<td>$variable6</td>");
print ("<td>$variable7</td>");
print ("<td>$variable8</td>");
print ("</tr>"); }
} else {
echo "No results returned";
}
} else {
echo "Query error: ".mysql_error();
}
$batch1 = $_GET['variable1'];
mysql_close($con);
?>
</table>
<script language="JavaScript" type="Text/JavaScript">
//Will call the popup Window for Entry.
var fifteenth;var sixteenth;var seventeenth;
function eighteenth(nineteenth,twentieth) {
seventeenth=eval("document.getElementById('"+nineteenth+"')");sixteenth=twentieth;fifteenth=seventeenth.childNodes[0].nodeValue;seventeenth.childNodes[0].nodeValue=twentieth;}
function first2() {
seventeenth.childNodes[0].nodeValue=fifteenth;}
</script>
</center>
<center>
<script>
<!--
function openpopup(url, windowtarget)
{
window.open(
url,
windowtarget,
'width=570,height=290,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0');
}
// -->
</script>
<a href="entry.php?param1='$batch1'"
target="entry"
OnClick="openpopup(this.href, 'entry');
return false;">Entry Screen</a>
</center>
That code is from the main form that processes the SELECT and displays the data - this works fine.
The next code is the popup window and the variable I need is not pulling. I know this is syntax or improper use of commands, because I'm not familar with them.
<form method="POST" name="Recv" action="imeientry.php">
<table width="400" border="0" cellspacing="2" cellpadding="3">
<tr>
<td colspan="2" bgcolor="#000000"><span class="style1">Receiving Screen</span></td>
</tr>
<tr>
<td bgcolor="#FFCC66">Serial Number: </td>
<td bgcolor="#CCCCCC"><input name="SerNum" type="text" id="SerNum"></td>
</tr>
<tr>
<td width="135" bgcolor="#FFCC66">Asset Number:</td>
<td width="300" bgcolor="#CCCCCC"><input name="AssetNum" type="text" id="AssetNum"></td>
</tr>
<tr>
<td> </td>
<td><input type="button" name="submit" value="Enter IMEI" onClick="document.Option_Recv.submit();" /></td>
</tr>
</table>
</form>
<?php
$BatchNumData=$_GET['$batch1'];
echo "Your Batch Number is:\n$BatchNumData";
// Connect to mysql database
$con = mysql_connect("localhost","root","R00tb33r!") or die('Connection: ' . mysql_error());;
mysql_select_db("snatest", $con) or die('Database: ' . mysql_error());
mysql_close($con);
?>
The value of the $batch1 variable is not pulling over correctly. Currently I'm just trying to get the code over to the php popup so I can continue writing the other requirements, but I'm stuck. Can anyone suggest some ideas to try?