mglover88 Posted May 21, 2011 Share Posted May 21, 2011 Hi, I was just wondering if it were possible (and if so how) to open a page in a new window when submitting a form via php? E.g. I have a poll on my website that is directed to the reults page by $insertGoTo = "results.php";. This all works but what I want to happen is for when the user clicks submit that the results page displays in a new window (or at the very least a new tab), similar to what would happen when you put a target=_blank on a html link. Any help would be very appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/237061-open-results-page-in-new-window/ Share on other sites More sharing options...
Pikachu2000 Posted May 21, 2011 Share Posted May 21, 2011 PHP is a server-side language. It can't control the user's browser. You may be able to accomplish this with Javascript somehow, but that's not one of my strengths at all. Link to comment https://forums.phpfreaks.com/topic/237061-open-results-page-in-new-window/#findComment-1218486 Share on other sites More sharing options...
Fadion Posted May 22, 2011 Share Posted May 22, 2011 Hmmm you mean: <form method="post" action="action.php" target="_blank"> <input type="text" name="myfield" /> <button type="submit">My Button</button> </form> The "target" attribute is deprecated in XHTML and will not validate with a Strict Doctype, but brought to life in HTML5. You can use it safely as browser support is assured. Link to comment https://forums.phpfreaks.com/topic/237061-open-results-page-in-new-window/#findComment-1218548 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.