I'm currently using the following to show a random value on page load. However, I would like to have a blank page to start with, and show the random value when the user clicks a button. I understand this must be done client side and with .js, but I don't understand how to use .js to activate the said php, or rather, the echo part of it:
<?php
$strings = array(
"Option 1",
"Option 2",
);
shuffle($strings);
echo reset($strings);
?>
The reason I don't want to do this with .js only, is that I like the idea that all options are not shown upon inspection of the source.
Is this possible?
Aucun commentaire:
Enregistrer un commentaire