Jump to content

close window button


knowram

Recommended Posts

I have a page that reloads itself every time you hit a different submit button. I am trying to put a button on the bottom of the page that the user can use to close the window when they are done. Here is the code that I am using so fare

[code]
        <input type="button" value="Close Window" onClick="self.close();" >
[/code]

this works great the first time the page loads if that is the first thing you click. But if you use a different button which reloads the page the close window button will no longer work.

anyone know how to fix this problem?
Link to comment
https://forums.phpfreaks.com/topic/11245-close-window-button/
Share on other sites

you can trying something like this. Let's say you are passing ID as a variable to page.php?ID=3
[code]
<?PHP
$iframe_link = "iframe_page.php?ID=".$_GET['ID']
?>
<iframe src="<?= $iframe_link ?>"></iframe>
<button onclick="window.close();">Close</button>
[/code]
this should pass the ID variable to the iframe page.
Link to comment
https://forums.phpfreaks.com/topic/11245-close-window-button/#findComment-42226
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.