0

Is it possible to submit a form into a new window (its ok, target parameter works) and I'd like load a page also into the window where I submitted the form.

I'd like to to this two event with one submit button.

Is this possible?

    echo '<form name="lezaratlanok" action="blokk.php" method="post" target="_blank">';
    echo '<input type="hidden" name="asztalkod" id="asztalkod" value="'.$_POST['asztalkod'].'">';
    echo '<input type="hidden" name="print_mit" id="print_mit" value="blokk">';
    echo '<input type="submit" style="height:30px;font-size:20px;background-color:#FFFF00;color:#FF0000;" value="Asztal lezárása, blokk készítése">';
    echo '</form>';

I'd like to reload an index.php to the above form windows. The blokk.php called successfully, and load into new window.

Woodyka
  • 51
  • 2
  • 9
  • Welcome to Stackoverflow. What have your tried so far and what is the specific problem? Please take the time to read this http://stackoverflow.com/help/how-to-ask and edit your question with a specific problem, displaying attempt(s) and relevant source code helps. For questions such as (is it possible) with no attempts made, I recommend you to do some research. Google is your best friend. – NewToJS May 25 '15 at 17:31
  • I hope my above form code help to understand my problem. – Woodyka May 25 '15 at 17:56

2 Answers2

1

I've found an other solution for my problem: dont want to assign two page for one form, but I made another hidden form for the second event, and submit the both form with this solution:

Submit two forms with one button

Community
  • 1
  • 1
Woodyka
  • 51
  • 2
  • 9
  • But i needed a javascript delay, between two submit, because of the sequence of the forms. var delay=1000; //1 seconds setTimeout(function(){ //your code to be executed after 1 seconds }, delay); – Woodyka May 26 '15 at 15:51
0

You need to use JavaScript for that to submit the form here is the code

jQuery(document).ready(function () {
    alert("Hi Page Loaded");
    jQuery("#myForm").submit(function () {
        var mapForm = document.createElement("form");
        mapForm.target = "_blank";
        mapForm.method = "POST";
        mapForm.action = jQuery(this).attr("action");
        var mapInput = document.createElement("input");
        mapInput.type = "text";
        mapInput.name = "s";
        mapForm.appendChild(mapInput);
        mapForm.submit();
        setTimeout(reload, 1000);
        return false;
    });
});
function reload() {
    window.location.reload()
}
Mitul
  • 3,431
  • 2
  • 22
  • 35
  • This post wouldn't qualify to be an answer. No links to documents on how to or any demo/example source code. The question isn't too good either but this post should be posted as a comment. – NewToJS May 25 '15 at 17:28
  • I recommend you post your answer when you have the source code ready otherwise you can find people will downvote you. – NewToJS May 25 '15 at 17:33
  • I have added code https://jsfiddle.net/patelmit69/e7rqkj4o/13/ is the working copy but i can't find the way how to add link into the ans it give me error – Mitul May 25 '15 at 17:45
  • I hate to be picky but jQuery isn't tagged in this question. Offering a jQuery solution when it isn't tagged is fine as long as you clearly point out the use of jQuery. – NewToJS May 25 '15 at 17:49
  • Ohh But he mention the javascript so i have used jquery it can possible using only javascript after doing small change. – Mitul May 25 '15 at 17:52
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/78714/discussion-between-mitul-and-newtojs). – Mitul May 25 '15 at 17:55
  • The source code you have in this answer is jQuery. jQuery **is not** tagged in the question. You don't state the use of jQuery. Woodyka might not be able to access jQuery for whatever reason. – NewToJS May 25 '15 at 17:55