How can I make a Javascript roulette [closed]

3

Well my question is this:

I have an HTML form, which when loading on submit it gives me a random number of 1 to 5 in PHP. What I wanted to know was, how could I do that by clicking on the button PHP would select one of the numbers 1 to 5 randomly and then send to a simple roulette in javascript to show the number chosen. In other words, the roulette wheel would simulate rolling and tucking into the chosen number.

    
asked by anonymous 17.06.2015 / 05:01

1 answer

0

To generate the random number in php use the rand () function, it accepts two arguments initial number and the end of a range.

<?php
   $numero = rand(1 , 5);
   echo $numero;

The echo of the number can be done inside ( value ) of an input hidden, so the value can be retrieved by javascript with document.getElementById() .

Example - ideone

    
17.06.2015 / 21:19