submit form without submit button

Home > Javascript Tutorial > submit form without submit button

Best PHP Live Project Based Winter Training in Noida for more details click here

Submit Form Without Submit Button

You can submit a html form without submit button using javascipt submit( ) and display the output on php page.

Here is your html form where you have to enter your input

function submitform()
alert("your form submitted");
<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>
<div onclick="submitform()" style="color:blue;">Submit the form by clicking this</div>

Here is your Business logic part where you will get your outut

echo "Welcome : ".$_POST['n']."<br/>";
echo "Your email : ".$_POST['e']."<br/>";
echo "Your mobile : ".$_POST['m']."<br/>";
echo "Your Adds : ".$_POST['reply'];