Do not want Html after php is executed -


i have following code:

<?php ...  ?>  <script> .... </script>  <html>  ... </html> 

after displaying html form, javascript should validate , php should save in database , give confirmation message.. happens is, after php executed , success message echoed, html form displays below message.. can avoid this?

i prefer set variable if form submission successful. following:

<?php $success = false;  if (isset($_post['submit'])) {     // process form submission     // if submission validates; set $success true } ?> <!doctype html> <html>   <head>     …   </head>   <body> <?php if ($success): ?>     <p>thank submission!</p> <?php else: ?>     <form action="" method="post">       …     </form> <?php endif; ?>   </body> </html> 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -