Question: For some reason if I try to assign a value to my input type hidden then I always get the same value (1), I can assign a value to it with javascript but not php..:

```
<?php
 $num = rand(1, 4);                     
?>  

 <?php echo $num; ?><?php echo $num; ?><?php echo $num; ?>

<input type="hidden" value="<?php echo $num; ?>" name="catch_num1">

```

If rand gave 4 this would give 444 but in input type it would always give value="1"??

It seems like a bug to me but I'm checking all my code in between.

Answer: 
Might be you set constant value to <http://cz2.php.net/srand> in prior to calling `rand`.
It can't be. `rand(min, max)` *always* gives value between the *min* and the *max*.

Have you tried `rand(4, 14)`? does it give you 1 too? are you sure you echo the `$_POST` value that actually IS this one and not another?

Try using [`mt_rand()`](http://www.php.net/manual/en/function.mt-rand.php)

Edit: well, I have found lots of results of the same problem. But each got its own reason.

If you're using Firefox for example, refresh using CTRL+F5 to omit cache. The random number might have been stored in cache or something?!