Hello
I created a form and use this php code for create limitation registration in form:
$max = 1;
$user = JFactory::getUser();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('COUNT('.$db->qn('Username').')')
->from($db->qn('#__rsform_submissions'))
->where($db->qn('FormId').'='.$db->q($formId))
->where($db->qn('Username').'='.$db->q($user->get('username')));
$db->setQuery($query);
$counter = $db->loadResult();
if ($counter >= $max){
$formLayout = '<p style="color:red;">Sorry, you have reached the maximum number of submissions for this form.</p>';
}
global $database;
$database = JFactory::getDBO();
$database->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE `formId`='25'");
$database->query();
if (intval($database->loadResult()) >= 33)
{
echo 'Dear user, Limitation of this group is full. Please try other Groups.';
$formLayout = '';
}
It work very exact.
But I have a dropdown list in this form. This php code just control limitation for all Item of dropdown list.
I need limitation for each item of dropdown in one form.
Example:
Group1
Group2
Group3
Registration capacity for item 1 is 33 user.
Registration capacity for item 2 is 23 user.
Registration capacity for item 3 is 13 user.
Each user just can fill this form for one time.
Form image is attached.
Please guide me.