In PHP I am Working on when form has been submitted the values should send to different files Using jquery. example if demo.php form has been submitted data should sent to both process1.php as well as process2.php simultaneously but Its not showing any error and not able to get output. please help me through this code I have tried so far
Demo.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>main form</title>
</head>
<body>
<form action="multi.php" method="post">
Name:<input id ='myname'>
<input type="button" id="btn" value="send to all">
</form>
<script
src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script type="text/javascript">
$(function(){
$('#btn').click(function(){
var username = $('#myname').val();
/*first post*/
$.post('multi1.php',{name:username},function(result){
$('#display').append("<br>"+result);
});
$.post('multi2.php',{name:username},function(result){
$('#display').append("<br>"+result);
});
});
});
</script>
</body>
multi1.php
<?php
echo "this is process1";
echo"and you have posted:".$_POST['name'];
?>
multi2.php
<?php
echo "this is process1";
echo"and you have posted:".$_POST['name'];
?>