Hello. I made a form on the page, it gives PTP variables to the right 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 normal (if without a script), BUT there is a need to open the page in a new window with the specified parameters. I use JS through the 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? Thanks in advance for your attention to the question - I.CaR®

    3 answers 3

    We collect value of input and we send through get. The easiest way to implement using jQuery. Rewrite a little bit.

     //задаем 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> 
    • Yeah, too, without waiting for the answer implemented almost the same method. I have more than one form. <script language = 'JavaScript'> function createLink (form) {var link = form.action + '?' for (var l = 0; l <form.elements.length; l ++) {link + = form.elements [l] .name + '=' + form.elements [l] .value if (l! = form.elements.length -1) link + = '&'} window.open (link, 'window', 'width = 360, height = 504')} </ script> and form'a <form action = '". $ Root." / (... here is the way ...) / page.php 'onSubmit =' createLink (this); return false '> Thank you very much! for the response - I_CaR
     <form target="_blank">...</form> 
       <form method=post action='".$root."/(...тут путь...)/page.php' target='имя окна которое откроет функция WindowOpen2' onsubmit='WindowOpen2();return true;'> 

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