Opening a window with options

Hello.
I made a form on the page, it sends variables via POST to the desired php page.

<form method=post action='".$root."/(... ...)/page.php'>
<input type='hidden' name='first' value='$second'>
<input type='hidden' name='second' value='$first'>
<input type='submit' value='' onclick='WindowOpen2()' style='cursor:pointer;'>
</form>

Everything is fine (if no script), BUTthere is a need to open the page in a new window with the given parameters. Using JS via window.open:

function

<script language='javascript'>
function WindowOpen2()
{
window.open('".$root."/(... ...)/page.php','0x0','toolbar=no, status=no, scrollbars=no, location=no, menubar=no, directories=no, width=360, height=504, top=200, left=400')
}
</script>

Here’s how to get data from the above inputs into this window?
Thank you in advance for your attention to the issue – I.CaRĀ®


Answer 1, authority 100%

We collect the value of the inputs and send it via get. The easiest way to implement it is using jQuery. Let’s rewrite a little.

// id 
<form id="form1" method=post action='".$root."/(... ...)/page.php'>
    <input type='hidden' name='first' value='$second'>
    <input type='hidden' name='second' value='$first'>
    <input type='submit' value='' onclick='WindowOpen2()' style='cursor:pointer;'>
</form>
<script language='javascript'>
function WindowOpen2()
{
    //  ,   GET 
    window.open('".$root."/(... ...)/page.php?' + $('#form1').serialize(), '0x0','toolbar=no, status=no, scrollbars=no, location=no, menubar=no, directories=no, width=360, height=504, top=200, left=400')
}
</script>

Answer 2, authority 50%

<form target="_blank">...</form>

Answer 3, authority 50%

<form method=post action='".$root."/(... ...)/page.php' target='     WindowOpen2' onsubmit='WindowOpen2();return true;'>

and from the submit button, you can simply remove your Onclick