I put a loop to get all my values of my database. Then, at the very left of each row there's a button to open another page to see all the database from a specific user. My problem here is that when you click on my button, there's a function that appears (function ouvrirEditFormulaire) and what I am trying to do is to get 4 values and to send it to that page : acceptation.php. So in my function I open a new window, then with ajax send my data to eFormulaire.php and I tried to innerHTML a div inside my other page (acceptation.php) but nothing happens. The most I could do is to innerHTML a div inside my first page (when you click on the button)...is there any way to send data to my acceptation.php ???
My AJAX :
function ouvrirEditFormulaire(id,date,heure,client) {
window.open('concessionnaire/acceptation.php','mywin','left=20,top=20,width=650,height=730');
var xhr = new XMLHttpRequest();
xhr.open("POST","concessionnaire/eFormulaire.php",true);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
document.getElementById('divAnotherPage').innerHTML = xhr.responseText;
}
}
xhr.send("id="+id+"&date="+date+"&heure="+heure+"&client="+client);
}
eFormulaire.php :
<?php
include_once('../connect.php');
$object = new User;
$id = $_POST['id'];
$date = $_POST['date'];
$heure = $_POST['heure'];
$client = $_POST['client'];
?>