Page 1 of 1
Pop-up new window (without nav tools - such as back but etc)
Posted: Mon Nov 24, 2003 5:03 pm
by billy_022
How do you make a link start a new window which pops up - without the normal navigation tools which you find in a normal browser window.
I want the pop-up window to have a form in it, which enables the user to enter information, and then submit the form. The window should be set at a specific size (only small)
(this pop-up will take the role of a dialog box, which you might find in a windows application)
Posted: Mon Nov 24, 2003 5:04 pm
by d3ad1ysp0rk
this would be done in javascript, not PHP

Posted: Mon Nov 24, 2003 5:07 pm
by Gen-ik
Code: Select all
<script type="text/javascript">
window.open("page.php", "", "left=0, top=0, width=300, height=300, resizable=no, menubar=no, toolbar=no, location=no, status=no");
</script>
Posted: Mon Nov 24, 2003 5:32 pm
by billy_022
how do I execute that code from a php file?
So, I need to make that javascript the action of a button. So when the button is clicked, the action is that it calls that javascript..
Posted: Mon Nov 24, 2003 5:35 pm
by d3ad1ysp0rk
its all html/javascript
i never really learnt much javascript, but from what i know, it'd be something like this:
Code: Select all
<html>
<head>
<script type="text/javascript">
function yourfunction() {
window.open("page.php", "", "left=0, top=0, width=300, height=300, resizable=no, menubar=no, toolbar=no, location=no, status=no");
}
</script>
</head>
<body>
<a href="javascript:onclick(yourfunction)"><img src="button.gif"></a>
</body>
</html>
like that? (not sure..)
Posted: Mon Nov 24, 2003 6:10 pm
by billy_022
I could not get that to work, it just does nothing, and it says error on page down the button left corner
now - getting the original page to refresh
Posted: Mon Nov 24, 2003 7:17 pm
by billy_022
Hi, I got the above code working..
At the moment, I have a button in a.php, and upon clicking, it window.open() a new window(b.php), containing a form. The form posts variables back to a.php, however, the new window loads a.php, containing the new variables, but instead of this - I want the first window to load a.php. After this, I want to close the new window, which I can do easy by window.close();
So, how can I make the action of the form to load a .php file in a different window other than the current window?
Posted: Mon Nov 24, 2003 9:41 pm
by Gen-ik
billy_022 wrote:So, how can I make the action of the form to load a .php file in a different window other than the current window?
To put it simply, you don't.
What you have to do is send the form (which is in the pop-up window) to another file in the pop-up file.
Now the trick is this. You need to get the PHP page that check the form to do one thing if the form is ok and another thing if it's not.
If the form is ok then you need to get the PHP page to write some javascript to the page. If the form is not ok then PHP will need to either display an error message or go back to the form.
The javascript would look something like this...
Code: Select all
<script type="text/javascript">
window.opener.location.href = "thePage.php";
window.close();
</script>
[/close]
The main window that launched the pop-up window will go to whatever page you change "thePage.php" to. And obviously the window.close() bit will close the pop-up window.