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 ?


doctorbillTechAsked:
Who is Participating?
 
Gurvinder Pal SinghCommented:
make it
onchange="javascript:custpopup(this.value)";>


function custpopup(value)
{
window.open('http://localhost/comwebsites/1callorders/site/cust_find_visit_byname.php?txtName=' + value + '&button2=Find','jav','width=850,height=175,resizable=yes,scrollbars=yes,location=1');
}
0
 
doctorbillTechAuthor Commented:
sorry:
The "onchange2event  should be "onchange event"
0
 
doctorbillTechAuthor Commented:
excellent - just what I needed, and such a fast response !!!!!
Thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.