doctorbill
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:custp opup()";>
<option value="Select Name">Select Name</option>
<?php
do {
?><option value="<?php echo $row_cust['Name']?>"><?php echo $row_cust['Name']?></optio n>
<?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']?>&button 2=Find','j av','width =850,heigh t=175,resi zable=yes, scrollbars =yes,locat ion=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 ?
<select name="txtName" class="input_boxes_orders_
<option value="Select Name">Select Name</option>
<?php
do {
?><option value="<?php echo $row_cust['Name']?>"><?php
<?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']?>&button
}
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 ?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
excellent - just what I needed, and such a fast response !!!!!
Thanks a lot
Thanks a lot
ASKER
The "onchange2event should be "onchange event"