texmansru47 Posted July 9, 2008 Share Posted July 9, 2008 All, I have a php form that will spawn a popup window (via javascript) to another php form (popup window) where the user will have to enter in two values for each product that are scanning into the batch (a batch can have a qty ranging from 1 to 500 typically). I have the following code in my two pages: Main php form: while($copy = mysql_fetch_array($results)) { $variable1=$copy['BatchNum']; $variable2=$copy['ProdNum']; $variable3=$copy['OSku']; $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 = $copy['BatchNum']; 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;">IMEI Entry Screen</a> </center> and here is the code for the popup Window: <form method="POST" name="Recv" action="entry.php"> <table width="400" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="2" bgcolor="#000000"><span class="style1">RecvControl</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="submit" value="Enter Asset" /></td> </tr> </table> </form> <?php $BatchNumData=$_GET['param1']; echo "Your Batch Number is:\n$BatchNumData"; // Connect to mysql database $con = mysql_connect("localhost","user","xxxx") or die('Connection: ' . mysql_error());; mysql_select_db("test", $con) or die('Database: ' . mysql_error()); mysql_close($con); ?> It that last code I have eliminated all the other PHP functions and code until I get the variable to pull over correctly. I have been trying to find the data on how to pass a php variable to a popup window (via a javascript call) but the pages I have found all state what I'm trying and the variable is not pulling... I keep getting the value of the variable I setup on the second page (the 'param1' word instead of the batch number assoicated to the variable I set in the first page. Any ideas where I'm screwing this up? Thanks, Texman Link to comment https://forums.phpfreaks.com/topic/113922-the-php-variable-is-not-passing-to-the-popup-window/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.