Reputation: 51
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.
Upvotes: 0
Views: 407
Reputation: 51
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
Upvotes: 1
Reputation: 3427
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()
}
Upvotes: 0