Link to home
Create AccountLog in
Avatar of doctorbill
doctorbillFlag for United Kingdom of Great Britain and Northern Ireland

asked on

javascript popups and php record sets

I have the following dropbox in a web page:

<select name="txtName" class="input_boxes_orders_add" id="txtName" onchange="javascript:custpopup()";>
                  <option value="Select Name">Select Name</option>
                  <?php
do {  
?><option value="<?php echo $row_cust['Name']?>"><?php echo $row_cust['Name']?></option>
                  <?php
} while ($row_cust = mysql_fetch_assoc($cust));
  $rows = mysql_num_rows($cust);
  if($rows > 0) {
      mysql_data_seek($cust, 0);
        $row_cust = mysql_fetch_assoc($cust);
  }
?>                </select>
This allows me to select a name from a database and it has an "onchange2event to call the following script:

<SCRIPT language="JavaScript">
<!--
//hide

function custpopup()
{
window.open('http://localhost/comwebsites/1callorders/site/cust_find_visit_byname.php?txtName=<?php echo $row_cust['Name']?>&button2=Find','jav','width=850,height=175,resizable=yes,scrollbars=yes,location=1');
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
//-->
</SCRIPT>

When I select a name from the dropbox, the popup opens the correct page buit the name is not being passed to the page recordset. If I hard code the name in the javascript in stead of using the php tags, the popup page opens and the correct name is passed to the recordset on the page and the correct information is displayed, so I know it works.

Question:
How can I get the selected name from the dropdown box to be passed to the popup page using this javascript and the php tags ?


Avatar of doctorbill
doctorbill
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

sorry:
The "onchange2event  should be "onchange event"
ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
excellent - just what I needed, and such a fast response !!!!!
Thanks a lot