If I use math.rand
in my JavaScript every time I press the button it will automatically change to a string. But when I use with php code why does it only change once.
How do I fix this?
<input type="text" id="adminrand" name="tokenid" placeholder="Enter Token" class="form-control" required>
<?php
date_default_timezone_set('Asia/China');
$tokentime=date('s');
$tokentime1= date('i');
$tokentime2=date('m') + date('d')+ date('y') + date('i');
$token = 'Phcl' . $tokentime .''. $tokentime1 . '' . $tokentime2;
?>
<button type="button" onclick="GenerateTokenx()">Generate</button>
<script>
function GenerateTokenx() {
let r = Math.random().toString(36).substring(5);
document.getElementById("adminrand").value ='<?php echo$token;?>';
}
</script>