Home >>Javascript Tutorial >submit form without submit button
<html> <head> <script> function submitform() { document.getElementById("myForm").submit(); alert("your form submitted"); } </script> </head> <body> <form method="post" action="yourdata.php" id="myForm"> <input type="text" name="n" placeholder="enter your name"/><br/> <input type="text" name="e" placeholder="enter your email"/><br/> <input type="text" name="m" placeholder="enter your mobile"/><br/> <textarea name="reply" placeholder="enter your address"></textarea> </form> <div onclick="submitform()" style="color:blue;">Submit the form by clicking this</div> </body> </html>
<?php echo "Welcome : ".$_POST['n']."<br/>"; echo "Your email : ".$_POST['e']."<br/>"; echo "Your mobile : ".$_POST['m']."<br/>"; echo "Your Adds : ".$_POST['reply']; ?>