I am trying to implement an unique id name for each hidden inputs inside while conditions suppose I have this code
while(mysqli_stmt_fetch($stmt)):
<button class="btn btn-success btn-xs" onclick="InitTime(<?php echo $row_id; ?>)">Send</button>
<input type="hidden" id="on" value="<?php echo $row_id; ?>">
endwhile;
function InitTime(row_id, on) {
var conf = confirm("Are you sure to execute <?php echo $row_id; ?>");
var on = $("#on").val();
if (conf == true) {
$.post("ajax/initializeTime.php", {
row_id: row_id,
on:on
}
);
}
}
But each time I click the button I get the first row ID from DB but it suppose to be different ID which is comes from DB
And in my initializeTime.php I retrieve same ID
if(isset($_POST['row_id']) AND isset($_POST['on']) )
{
//Here I retrieve the first ID from DB
}