shortcode to random number function returns same number
-
***RESOLVED***
If I force refresh the form page after submitting the form and then submit the form again, I get updated random numbers. I’ll have to force a refresh after the form is submitted to ensure this doesn’t happen.I have a simple function, and created a shortcode.
———–function uniquenum_function() { $uniqueNum = rand(10000,99999); return $uniqueNum; } add_shortcode('uniquenum', 'uniquenum_function');
———–
When I call the function from a page template and keep refreshing a page, I get a new random number each time.However, when I add the shortcode into my Contact Form 7 form using a hidden dynamic field and submit multiple forms, I get the same random number every time.
I’m having the same issue if my function returns a timestamp. I get the same timestamp over and over.
Anyone know why the value I’m returning from the function is “sticking” and repeating each time I submit the form? Is this some type of caching issue?
- The topic ‘shortcode to random number function returns same number’ is closed to new replies.