Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

submit form and show results on same page without refresh

<form id="myForm" method="post">
Name: <input name="name" id="name" type="text" /><br />
<input type="button" id="submitFormData" onclick="SubmitFormData();" value="Submit" />
</form>
<br/>
Your data will display below..... <br />
==============================<br />
<div id="results">
<!-- All data will display here  -->
</div>


<!-- SCRIPTS -->
function SubmitFormData() {
    var name = $("#name").val();
    $.post("submit.php", { name: name},
    function(data) {
	 $('#results').html(data);
	 $('#myForm')[0].reset();
    });
}

<!-- submit.php -->
<?php
  echo $_POST['name'] ."<br />";
  echo "=============== YOUR INSERT CODE ===============<br />";
  echo "All Data Submitted Successfully!";
?>
 
PREVIOUS NEXT
Tagged: #submit #form #show #results #page #refresh
ADD COMMENT
Topic
Name
6+9 =