So I wrote this function to generate a unique 8 digit code which works great. Basically someone is going to choose how many of these codes are going to be generated. 1, 10, 50, 100 etc. What I need is how to take this function and whatever value they chose on the form and generate that amount of unique id's.
This is Written in PHP
<? function generate_coupon_code () {
$numbers = uniqid();
$coupon_code = substr($numbers, -8);
return $coupon_code;
}
echo generate_coupon_code();
?>