Forum Moderators: coopster
I've taken a primtive screendump to try and explain my problem:
So in the example the main window displays the "magic number" and the calculator is launched. In this calculator the user can input a new "magic number", and what I want is for this number to be parsed back to the main page.
Further more I would love it if the magic number on the main page updated when the submit button in the popup is pressed.
I don't even know if this is remotely possible in PHP or if it would require javascript, but I'll take any suggestions at this point.
Thanks for reading!
[edited by: jatar_k at 1:19 pm (utc) on June 18, 2007]
[edit reason] no urls thanks [/edit]
I add a close page link to that page.
<a href="javascript:opener.location.reload(true); self.close();">Close Window</a>
That will reload the page that opened the popup.
As for transferring the info... maybe using sessions?
[edited by: eelixduppy at 2:03 am (utc) on June 19, 2007]
[edit reason] disabled graphic smile faces [/edit]
mainpage.php:
<script>
function openComment(url) {
popUpWin = window.open(url,'Comments','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,width=500,height=300');
if (navigator.appName == 'Netscape') {
popUpWin.focus();
}
}
</script><p><a href="javascript:openComment('popup.php')">Select a number</a></p>
<?
if (isset($_GET['number'])){
$magic_num = $_GET['number'];
echo "<p>Magic Number: $magic_num</p>";
}
?>
popup.php:
<form name="input" action="popup.php"
method="post">
Magic Number:
<input type="text" name="number">
<input type="submit" value="Submit">
</form>
<?
if(isset($_POST['number'])){$magic_num = $_POST['number'];
if(!is_numeric($magic_num)) {
echo "<p>INVALID NUMBER!</p>";
DIE();
}
?>
<p>You have selected <? echo $magic_num;?>.</p><p><a href="#" ONCLICK="opener.location='mainpage.php?number=<? echo $magic_num;?>';self.close();">Click here</a> to calculate.</p>
<?
}
?>
[edited by: eelixduppy at 2:04 am (utc) on June 19, 2007]
[edit reason] disabled smile faces [/edit]