Link to home
Start Free TrialLog in
Avatar of doctorbill
doctorbillFlag for United Kingdom of Great Britain and Northern Ireland

asked on

php popup script

I have the following scripts on a php page, which is working correctly:

Drop box script value:
----------------------
onchange="javascript:custpopup(this.value)"

Script called:
-------------------
<SCRIPT language="JavaScript">
<!--
//hide

function custpopup(value)
{
window.open('http://localhost/comwebsites/1callorders/site/cust_find_visit_byname_comment.php?txtName='+ value + '&button2=Find','jav','width=650,height=125,resizable=yes,scrollbars=yes,location=1');
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
//-->
</SCRIPT>

The value selected in the drop box is passed to the page in the function "custpopup" and brings up the correct data on the referenced php page. I need the popup window to ONLY SHOW ITSELF when  the dataset it is calling has data in a particular field (comment). This dataset is on the referenced php page:

<?php echo $row_comment['comment']; ?>
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doctorbill

ASKER

Can you guide me as to how to do this please ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will try this solution today but it looks as if the script will give me an alert message if the $row_comment has a value.

What I am after is the popup window ( window.open('http://localhost/comwebsites/1callorders/site/cust_find_visit_byname_comment.php?txtName='+ value + '&button2=Find','jav','width=650,height=125,resizable=yes,scrollbars=yes,location=1'); )
only showing if the $row_comment has a value
Here is my latest code. This works as it should if I enter a value into the '+ value +' field. What I need to be able to do is to create a variable which gets this value from a dropdown box on my page. I have tried using the following:
var value = (document.form2.txtName.value)
This does not work. This is the ONLY thing which is stopping this script from running.
How do I define a variable from a dropbox to be used in the javascript below ?

php Code:
---------------------------------------------
if(isset($row_custCom['comment'])){

echo "<SCRIPT language = JavaScript>
var value = (document.form2.txtName.value)
    window.open('http://localhost/comwebsites/1callorders/site/cust_find_visit_byname_comment.php?txtName='+ value + '&button2=Find','jav','width=650,height=125,resizable=yes,scrollbars=yes,location=1')
      </SCRIPT>";

}
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
didn't completely solve the problem