We help IT Professionals succeed at work.
Get Started

javascript popups and php record sets

doctorbill
doctorbill asked
on
342 Views
Last Modified: 2012-05-11
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 ?


Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE