Passing Variable to Parent

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TNIDBMNG
Forum Newbie
Posts: 21
Joined: Wed Aug 18, 2004 12:22 pm

Passing Variable to Parent

Post by TNIDBMNG »

I've searched high and low and can not find exactly what I'm looking for so I'm hoping someone here can put me in the right direction. I have a parent page that is an application when the user types in a phone number it opens a popup window letting them know if the phone number exists in a table. This works fine now I want to be able to tell reject the application by placing the value "Rejected" in the status field on the parent window. I also do not want to lose any information already entered on the form.

On the parent form the code I have is

Code: Select all

<?php
<input type="text" name="txtHomePhone" tabindex="24" value="<?php echo($homePhone); ?>" onBlur="popUpWindow('primus_checkPhone.php?phone=',450,150,150,150); return true;">
?>

Code: Select all

&lt;script language="javascript"&gt;
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
	
&#123;
	var phone=document.primus.txtHomePhone.value;
  	if(popUpWin)
  	&#123;
    	if(!popUpWin.closed) popUpWin.close();
  	&#125;
  	popUpWin = open(URLStr+phone, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
&#125;

&lt;/script&gt;
On the child window I have

Code: Select all

<?php
$homePhone=$_GET["phone"];

	$sql="SELECT * from tblTPV WHERE BTN='".$homePhone."' AND entered='No' AND Status='Y';";
	
	$result=mysql_query($sql,$cnx);

	if (mysql_num_rows($result)>0){
		echo ("TPV Exists"); }
	else {
		echo ("TPV Doen't Exist"); }
	echo '<br><br>';
	
	echo '<input type=button value="Close Window" onClick="javascript:window.close();"> ';
?>
Should I be using different code to do this or can I add some code to this? Any help is greatly appreciated.
User avatar
AnarKy
Forum Contributor
Posts: 119
Joined: Tue Nov 02, 2004 1:49 am
Location: South Africa

Sessions?

Post by AnarKy »

Perhaps u could try session vars. to pass data between the windows,
since they share common sessions.

:idea: I think there is also a way to update form elements using JavaScript,
if you name the document.

Something like:
document.form.textbox.value = "something";

I've forgotten most of this stuff :(
Post Reply