• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: generate random number script php

generate random number script php 5 years 8 months ago #39420

  • jkafonek
  • jkafonek's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
To generate a random number in rsform, I used this php script:
function random {
$ x = rand (1000000.9999999);
$ formID = $ _POST ;
$ db = JFactory :: getDbo ();
$ query = $ db-> setQuery ("SELECT`SubmissionId`FROM #__rsform_submission_values WHERE`FormId` = '$ formID'AND`FieldName` =' random'AND`FieldValue` = '$ x' LIMIT 1");
$ results = $ db-> loadResult ();
if (! $ results) {
}
else {
random ();
}
}
$ _POST = random ();
The script does not report any error but does not write a value in a hidden field. Please help and advice. Thank you
The administrator has disabled public write access.

generate random number script php 5 years 8 months ago #39431

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
I needed something similar for use as a reference number so I used universal time like this in a hidden fields default value

//<code>
return time();
//</code>

This generates a unique number every time the form is submitted. I 'm not a coder so found this to be a simple solution for me.
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.

generate random number script php 5 years 8 months ago #39433

  • jkafonek
  • jkafonek's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
I need to generate a seven-digit number for the variable billing symbol for your solution, the numbers may match
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!