——-Parent window (first.php)
<html>
<head>
<title>Job Profile</title>
<script type=”text/javascript”>
function open_win(){
w = window.open(‘second.php’, null, ‘left = 103, top = 72, width=400,height=300,scrollbars=no,menubar=no,location=no,status=yes,resizable=yes,toolbars=no’);
w.document.supervisorform.txtsupervisor.value = document.jobprofile.txtsupervisor.value;
}
</script>
</head>
<?php
echo ” we are here”;
?>
<BODY>
<FORM name=”jobprofile” method=”POST” action=””>
<TABLE>
<TR>
<TD>
<DIV align=”right”>Supervisor : </div>
</TD>
<TD colspan=”2″>
<input type=”text” name=”txtsupervisor” size=”50″ maxlength=”50″ value=””>
</TD>
<TD colspan=”2″>
<input type=”button” onclick=”open_win();” value=”Browse”>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
——– child window (second.php)———-
<HTML>
<HEAD>
<TITLE> AeraSoft – SmartHR </TITLE>
<META NAME=”Generator” CONTENT=”EditPlus”>
<META NAME=”Author” CONTENT=””>
<META NAME=”Keywords” CONTENT=””>
<META NAME=”Description” CONTENT=””>
<SCRIPT LANGUAGE=”JavaScript”>
<!–
window.focus();
function passvariable(){
window.opener.jobprofile.txtsupervisor.value= supervisorform.txtsupervisor.value;
}
//–>
</SCRIPT>
</HEAD>
<BODY>
<FORM name=”supervisorform” METHOD=”POST” ACTION=”” >
<INPUT TYPE=”text” NAME=”txtsupervisor” value=””>
<INPUT TYPE=”button” name=”submit” value=”submit” onclick=”passvariable()”>
</form>
</BODY>
</HTML>
somebody pls try this coding ..
copy and save the first script as first.php
copy and save the second script as second.php
when you enter something in the Parent window and submit,
the value may be appeared in the child window. but if you keep clicking at the submit button, and you notice sometime the value doesn’t been passed into the child window… and sometime it does!
this problem is solved if the php coding in first.php(parent window) is removed..
can someone solve the problem for me?