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.
Edit your form, and create a new hidden field, name it "counter";
In the Default value, paste this code:
- 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}
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:






