Search
 
SCRIPT & CODE EXAMPLE
 

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!";
?>
Comment

PREVIOUS NEXT
Code Example
Php :: phpmail headers 
Php :: Passing values to blade using redirect() and back() functions 
Php :: checkout 
Php :: php artisan websockets serve 
Php :: how to empty an array in php 
Php :: create array of zeros php 
Php :: httpclient add authorization header symphony 
Php :: screen size to php 
Php :: login form tutorialpoint 
Php :: laravel telescope tutorial 
Php :: laravel get query result as array 
Php :: get id from object 
Php :: How to insert header in php 
Php :: laravel where json array column 
Php :: sage theme 
Php :: publish spatie/permission 
Php :: creating jobs laravel 
Php :: array filter php get first object 
Php :: laravel change string to text 
Php :: API call in PHP using cURL 
Php :: loop through objects in php 
Php :: self vs this in php 
Php :: laravel relations find 
Php :: How to add .active class to active menu item 
Php :: laravel run function after forgot password 
Php :: xampp php ini 
Php :: php .com 
Php :: optional route parameter in laravel 
Php :: PHP metaphone — Calculate the metaphone key of a string 
Php :: storefront product search 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =