An invoice will be opened in a new window when the Generate invoice button is clicked.
Below is the sample code. For Example
<form name="invoice" action="inv_rec.php" method="post" id="inv" target="invoices" onsubmit="return check_counter();" >
<table>
<tr>
<td>
<label for="cusname"><strong>Customer Name* </strong></label>
<input type="text" size="20" name ="cusname" value="" id="Customername" required/>
</td>
<td>
<label for="for_place"><strong>Place</strong></label>
<input type="text" size="20" name ="for_place" value="" id="for_place" />
</td>
</tr>
........
<tr>
<td>
<input type="submit" value="Generate Invoice" name="submit" id="sub">
</td>
</tr>
</table>
</form>
<script>
var counter = 1;
function check_counter()
{
if(counter == 1)
{
alert("Please enter the product details");
return false;
}
window.open('', 'invoices', 'width=650,height=800,status=yes,resizable=yes,scrollbars=yes');
return true;
}
</script>
In my example the page will be redirected to inv_rec.php(opens in new window) which contains dynamically generated data obtained from mysql where the user needs to take the print of it. I want to clear all the form data which is open in the previous window(where the invoice form is displayed,i.e user fills the data to generate a invoice).