window.print function call after form validating form in php -


i have problem, want print a div after form validating , submitting. issue is, when call print.window function in submit button, display print window without validating form fields.

input type="submit" value="submit" class="button" name="submit" onclick="window.print()">

while div print in

if($_post['submit']) { echo"print div here"; }

please help.

thanks

if want print after form validating , submitting, supposed in client side.

you can this:

<form name="myform" action="action.php" onsubmit="return validateform()" method="post">      name: <input type="text" name="fname">     <input type="submit" value="submit"> </form> 

then, validate form , print.

<script> function validateform() {     // validate form here     window.print(); } </script> 

hope helps.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -