Hi I have a problem that has been bugging me for ages I need to launch a pop up window, the pop up has a form which when submitted closes the pop up window and Posts to a php page which overwrites the parent window.
I can get all the independant bits to work but not them all together.
heres the 3 files with all the testing taken out. Any help would be appreciated.
3 files start.html, form.html, result.php
---------------------------------
start.html (the first file that launches the pop up (form.html))
<HTML>
<HEAD>
<TITLE>Start Page</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var newwin;
function launchwin(winurl,winname,winfeatures)
{
newwin = window.open(winurl,winname,winfeatures);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM><INPUT TYPE="BUTTON" VALUE="Launch Form" ONCLICK="launchwin('form.html' , 'newwindow' , 'height=150,width=300')"></FORM>
</BODY>
</HTML>
-----------------------------------
form.html - the file that should POST to result.php, in the main frame and then close - this is where the problem is
<html>
<BODY>
<SCRIPT language="JavaScript">
function submitform()
{
document.theform.submit();
window.close();
}
</SCRIPT>
<form name="theform" action="result.php" method="post">
Enter your name: <input type="text" name="name" />
<A href="javascript: submitform()">Enter</A>
</form>
</body></html>
--------------------------------
result.php - file that echoes the data in the form in the parent window
<html><body>
Hello
<?php echo $_POST["name"]; ?>.<br />
</body></html>
I can get all the independant bits to work but not them all together.
heres the 3 files with all the testing taken out. Any help would be appreciated.
3 files start.html, form.html, result.php
---------------------------------
start.html (the first file that launches the pop up (form.html))
<HTML>
<HEAD>
<TITLE>Start Page</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var newwin;
function launchwin(winurl,winname,winfeatures)
{
newwin = window.open(winurl,winname,winfeatures);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM><INPUT TYPE="BUTTON" VALUE="Launch Form" ONCLICK="launchwin('form.html' , 'newwindow' , 'height=150,width=300')"></FORM>
</BODY>
</HTML>
-----------------------------------
form.html - the file that should POST to result.php, in the main frame and then close - this is where the problem is
<html>
<BODY>
<SCRIPT language="JavaScript">
function submitform()
{
document.theform.submit();
window.close();
}
</SCRIPT>
<form name="theform" action="result.php" method="post">
Enter your name: <input type="text" name="name" />
<A href="javascript: submitform()">Enter</A>
</form>
</body></html>
--------------------------------
result.php - file that echoes the data in the form in the parent window
<html><body>
Hello
<?php echo $_POST["name"]; ?>.<br />
</body></html>