mercredi 8 août 2018

How do you get or pass the variable that is clicked then use it in the other page or in the modal?

For example I have this code here

$query = $con->query("SELECT * FROM acc");
while($row = mysqli_fetch_array($query))
{
   echo $row['username'];
   <button data-target="#click" data-toggle="modal">Click this array</button>
}
include_once 'modal.php';

//This is the modal php file
<div class="modal" id="click">
   //for example I want to get the value of the current ($row['username']) that I clicked and then use it in the new query. 
   $newQuery = $con->query("SELECT * FROM client WHERE username = ".$row['username']."");

</div>

How do you get the array value that is clicked by the button into the next page or in modal? Should I use javascript or something?

Aucun commentaire:

Enregistrer un commentaire