Form submitting data to new window and to two different pages

Submit form to two windows
<input type='submit' value='Open default action file test5.php' 
	onclick="this.form.target='_blank';return true;">
<input type='submit' value='Open test6.php'
	onclick="f1.action='test6.php';  return true;">
We can use two different buttons to submit the form to two different pages. One of the buttons can submit the form in a new window. You can read the article on how to open the action page of the form in new window. This is required in different occasions where the visitor can see check and decide on which page to use.
Submitting form to new window and multiple submit buttons to post data to different target pages


We can use the same form to submit to two different pages. The demo below will submit a form to two different pages.

For example we can show a printer friendly page to the visitor on its entered value in a new window. The visitor can check the values in new window and close it also. Again the visitor can do changes in main window and check the printer friendly page. Once satisfied, the visitor can finally submit the page for processing. Here is the example showing two buttons, one is submitting the form to same page and other is submitting to a new page by opening a new window.

You can see the two buttons below and one will open the test5.html page in this window and the other button will open test6.html in a new window ( keeping this window in same page ).

Here is the demo with two submit buttons to submit form to two different pages.



Here is the code for the above form with the submit button.
<form name=f1 method=post action=test5.php>
<input type=text name=name value='plus2net'>
<input type='submit' value='Open default action file test5.php' 
	onclick="this.form.target='_blank';return true;">
<input type='submit' value='Open test6.php'
	onclick="f1.action='test6.php';  return true;">
Submit form to a new Window HTML and JavaScript Code for Back to Previous Page
HTML Form

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    kundan

    27-06-2014

    nice help me alot thanks
    osiris

    17-08-2014

    very nice helped me alot thx
    bol

    12-09-2014

    You are the best
    vishnu

    20-09-2014

    this is very useful thanks i got my problem solution from here ..
    ekke

    16-10-2014

    Yupp, it helped to solve my problem. Thanks!
    peter

    09-12-2014

    thanks man! :)
    san

    17-04-2015

    this is very useful thanks i got my problem solution from here ..
    Thank you so much..... :)
    Keep us updating such nice codes
    pratish

    12-11-2018

    +1...it helps me a lot if......Can it redirect with _POST method will all the form field name? If another php want to POST all form field.
    smo1234

    25-11-2018

    You can add all form field names to the form. After receiving you can redirect to any page.

    25-04-2020

    this is genius, thanks a lot.

    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer