# PHP new browser window ?



## abhinav_kishore (Apr 14, 2008)

Hi,

I have a PHP page of the following structure :

if(condition is true)
{
echo "<html><--HTML Block1--></html>";
}
else
{
//condition is false
echo "<html><--HTML Block2--></html>";
}

I basically want the HTML Block1 to open up in the same browser window but HTML Block2 to open up in a new tab/window when the script is executed (the script is called by clicking on the "Submit Form" button of a webpage). Is this possible with PHP ? Tried to google.. no help 

Thanx in advance...


----------



## DumberDrummer (Oct 27, 2003)

Make HTML Block2 its own file, and throw in this javascript. 

```
<script type="text/javascript">
window.open('URL of HTML Block2');
</script>
```
PHP is server side, so unfortunately I don't think it can create new windows, just render HTML out of the language. 

Keep in mind too that firefox will block that new window javascript unless you put it in a button of some kind to prevent pop ups, but you said its a "Submit Form" button, so you should be just fine.


----------



## abhinav_kishore (Apr 14, 2008)

DumberDrummer said:


> Make HTML Block2 its own file, and throw in this javascript.
> 
> ```
> <script type="text/javascript">
> ...


Hi DD,

Thanx for the response. But I have another concern. The "Submit" button of mine is getting some form data from the previous HTML page which is being processed by this PHP and displayed in HTML tables. If I create a different html file for the Block2, then I'll need to figure out some way of passing all these form values to that new page. Woudln't that be too cumbersome ?

Cheers...


----------



## DumberDrummer (Oct 27, 2003)

It may be, but I know of no way to get php to open up a new window.


----------

