Hey there StackOverflow community as the title says , I have a table in my DB with 2 columns ID and Name. there is a html form with a button, by clicking the button I want it to pick a name. by clicking again , it picks a name without repeat until all names are used.
Here's what I've done so far:
<?php
include ("config.php");
$result = '';
if (isset($_POST['rand'])) {
$name_query = mysqli_query($conn,"SELECT * FROM names ORDER BY RAND() LIMIT 1");
$name_f = mysqli_fetch_assoc($name_query);
$result = $name_f['name'];
}
?>
<form action="" method="post" accept-charset="utf-8">
<input type="submit" name="rand">
</form>
<div><?php echo $result;?></div>
thanks in advance.