Hi, am not sure what you mean by 1 in 5 chance?? Does that mean 2 winners every 10?
It is a bit of a puzzler as i only ever randomize to pick winners or set some kind of status, but by your post above i can see why you need to do it that way as i assume you pick winners straight away and not after the survey has finnished (which would be easy).
Or have i misunderstood? Anyway you could use your code and also check whether it is odd or even. So say every fifth wins first and every tenth wins second prize.
Code:
<?php
$win = $id/ 5;
if(!is_float($win)&&($win &1)) {
$winner="Winner";
$messagecode = 22;
$printwin ="Digital Photo Frame WINNER!";
}
elseif (!is_float($win)&&(!($win &1))) {
$messagecode = 1983;
$printwin ="Second Prize.";
}
else {$printwin ="No Winner.";}
echo "$printwin";
?>
Same as yours apart from the odd-even check and i replaced preg_match with is_float...both perfectly fine