Unfortunately, the username and password you have entered do not match!

Registration

Unfortunately, this username is already taken!

Unfortunately, this e-mail address is already used!

Please retype the verification code.

All fields are required

RSForm!Pro - Adding a counter for submissions

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". We will present this in a step-by-step process.

  1. Edit your form, and create a new hidden field, name it "counter";

  2. In the Default value, paste this code:

  3. For RSForm! Pro revision 29 and previous revisions.

    //<code>
    return intval(@mysql_result(mysql_query("SELECT COUNT(`SubmissionId`) cnt FROM ".$RSadapter->tbl_rsform_submissions.""),0))+1;
    //</code>

    For RSForm! Pro revision 30 and above.

    //<code>
    $db=JFactory::getDBO();
    $db->setQuery("SELECT COUNT(`SubmissionId`) cnt FROM #__rsform_submissions");
    $db->query();
    $result=$db->loadResult();
    return intval($result)+1;
    //</code>

    You can count submissions for a specific form by using this code:

    For RSForm! Pro revision 29 and previous revisions.

    //<code>
    return intval(@mysql_result(mysql_query("SELECT COUNT(`SubmissionId`) cnt FROM ".$RSadapter->tbl_rsform_submissions." WHERE FormId=1"),0))+1;
    //</code>

    For RSForm! Pro revision 30 and above.

    //<code>
    $db=JFactory::getDBO();
    $db->setQuery("SELECT COUNT(`SubmissionId`) cnt FROM #__rsform_submissions WHERE FormId=1");
    $db->query();
    $result=$db->loadResult();
    return intval($result)+1;
    //</code>

    Note:

    • You will need to replace "1" with your own form id.
    • To display the result please edit your "Thank you message" and add the following:

      You are submitter number: {counter:value}
Feedback