I created a form containing 4 boxes, if all 4 boxes have been filled the outputs are expected to shuffle into 4 groups. I have tried to used the array_rand() function but it will only randomise the output as instructed.
So i need it to shuffle without me knowing the sequence, which i tried to do but its not working as the database did not output the data.
How do i make it sync with the database? How do i make it work?
$a = array("$name1", "$name2", "$name3", "$name4");
shuffle($a);
$teamA = $a[0];
$teamB = $a[1];
$teamC = $a[2];
$teamD = $a[3];
$sql="INSERT INTO `teams`( `team_a`, `team_b`, `team_c`, `team_d`) VALUES ('$teamA','$teamB','$teamC','$teamD')";
$store= mysqli_query($conn,$sql);
if($store){
echo'Registration Sucessful';
}else{
echo'Not sucessful';
}