Adding a counter for submissions

In this article we will describe how to create a submission counter and displaying it in the "Thank you page".

  1. Create a new hidden field, name it "counter";

  2. In the Scripts called on form process field from the PHP Scripts tab please add the following code(this will count the submissions and store the value in the previously defined hidden field)

      $db = JFactory::getDbo();
      $db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE FormId='".(int) $formId."'");
      $_POST['form']['counter'] = $db->loadResult()+1;

    Note: To display the result please edit your "Thank you message" and add the following:
    You are submitter number: {counter:value}

    13 persons found this article helpful.

    Was this article helpful?

    Yes No
    Sorry about that