Dear friends,

I have this form (raffle_winner_form.htm) with the action in raffle_winner.php:

<form name="form1" method="post" action="raffle_winner.php">
Max numbers: <input type="text" name="max">

<input type="submit" name="submit" value="calculate">



$session = session_id();
$number = mt_rand(1,$_POST[max]);

My intention is to show the random number in a page that it is storing the session id with the generated number in an array and show it like: for example.

Any ideas?

Thank you in advance.

Try this code:

function getRandomString($length=5) 
    $characters = '0123456789abcdefghijklmnopqrstuvwxyz';
    $string = '';   
    for($i = 0; $i < $length; $i++) 
        $string .= $characters[mt_rand(0, strlen($characters))];
    return $string;
$number = getRandomString($_POST[max]);