My included file (include.php) is this:
<?php
$myarray=(a,b,c);
shuffle($myarray);
?>
My main php file is this:
include('include.php');
if isset($_POST['submit_button']){
echo "Button was clicked";
echo $myarray;
}
else {
echo "Not clicked.";
echo $myarray;
}
?>
<form method='POST'><input type='submit' name='submit_button'></form>
Why are the elements of $myarray
displayed in a different order after I clicked the button? Isn't it shuffled only once?
How can I prevent the shuffle from being executed more than one time? (so that I can display the elements of myarray in the same order, before and after the button was clicked)