pthurmond Posted November 26, 2006 Share Posted November 26, 2006 Can the header function be used to open a file in a separate window? I currently use them to redirect to another page within the current window. I would like to open some pages in a new window. Any ideas?Thanks,Patrick Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 26, 2006 Share Posted November 26, 2006 i'm not sure about that one. i dont think so, well not to my knowledge. i looked at the php site but found nothing, unless i didnt look hard enough. Quote Link to comment Share on other sites More sharing options...
taith Posted November 26, 2006 Share Posted November 26, 2006 you'd want to use javascript[code]<?function popup($text, $link, $name="myWindow", $height="300", $width="300", $resizable="0", $status="0", $class=""){ return '<a href="#" onclick=\'javascript: window.open("'.$link.'", "'.$name.'", "status='.$status.', height='.$height.', width='.$width.', resizable='.$resizable.'")\' class='.$class.'>'.$text.'</a>';}?>[/code] Quote Link to comment Share on other sites More sharing options...
pthurmond Posted November 26, 2006 Author Share Posted November 26, 2006 The problem is I have a script that has to store some data in the session data first and then redirects to a page that uses that data. The problem is I want the first page to open in the same window, but the redirected to page to open in another window. So I need it to automatically redirect to the page in a new window once it successfully processes the data.Any ideas.Thanks,Patrick Quote Link to comment Share on other sites More sharing options...
spelltwister Posted November 26, 2006 Share Posted November 26, 2006 you want to open a file literally or just change the page url for that separate window?I really can't tell what you're after Quote Link to comment Share on other sites More sharing options...
pthurmond Posted November 26, 2006 Author Share Posted November 26, 2006 I want to open that page in another window. That page produces a report from information in the database. Quote Link to comment Share on other sites More sharing options...
trq Posted November 26, 2006 Share Posted November 26, 2006 As has been said, you'll need to use Javascript. php doesn't eben know what a browser is let allone a new window. Quote Link to comment Share on other sites More sharing options...
pthurmond Posted November 26, 2006 Author Share Posted November 26, 2006 The problem is javascript as far as I have seen requires the user to click on a link to do this. I need this done on the server side as soon as the user submits valid data. Quote Link to comment Share on other sites More sharing options...
spelltwister Posted November 26, 2006 Share Posted November 26, 2006 you can have the javascript in the body for onLoad = 'javascript:whateverfunction()'when you have your original page redirect, have the if($_POST['submit']){ around the javascript function that way it will only fire if the redirect was from the origianl submit. You can also add in error handling. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted November 27, 2006 Share Posted November 27, 2006 if you use the body onload="" to pop up a new window, most popup stoppers will stop your popup! You should try to find a way to do it all in one window, keeping the current window and popping up a new window will fail in most cases because of popup stoppers. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 27, 2006 Share Posted November 27, 2006 you are also relying on js being on! admittedly this true the majority of the time but you should deisgn your site so that it doesn't need js and then add that on as an improvement for the vistors experience. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.