What I need to do is when the form was submit it opens in new window modal. I got this script in Javascript Post on Form Submit open a new window. When I try to submit the form it isn't working. Any help will appreciate.
Index.php
<form id="formprint" name="formprint">
<input type="text" name="search" id="search">
<input type="submit" name="print" value="print"/>
</form>
<script>
var form = document.getElementById("formprint");
form.setAttribute("method", "post");
form.setAttribute("action", "print.php");
// setting form target to a window named 'formresult'
form.setAttribute("target", "formresult");
var textField = document.getElementById("search");
textField.setAttribute("name", "search");
form.appendChild(textField);
document.body.appendChild(form);
// creating the 'formresult' window with custom features prior to submitting the form
window.open(../print.php, 'formresult', 'scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,status=no');
form.submit();
</script>
Print.php
<?php
if (isset($_POST['print'])) {
$search = $_POST['search'];
}
?>