I want to print a random 6 digit code on a certain input when I press a button. I wrote something. The code enters the input correctly, but when I click the button, it does not work.
This code:
<script>
function RefreshId()
{
<?php $randomid = rand(100000,900000); ?>
<?php console.log($randomid); ?>
}
</script>
<input type="text" name="user_code" value="<?php echo $randomid; ?>" class="form-control">
<button class="btn btn-light" type="button" style="position:absolute;top:0;right:12px;border-top-left-radius:0!important;border-bottom-left-radius:0!important" onclick="RefreshId()"><i class="mdi mdi-eye-outline"></i></button>
Via Active questions tagged javascript - Stack Overflow https://ift.tt/SnzXYF5
Comments
Post a Comment