Create capacity limitation for each Item in dropdown

Links for php scripts

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Tue Aug 05, 2014 10:33 am

Create capacity limitation for each Item in dropdown

Postby kareez55 » Tue Aug 05, 2014 10:45 am

I created a form and use this php code for create limitation registration in form:

Code: Select all

$max = 1;
$user = JFactory::getUser();
$db   = JFactory::getDbo();
$query   = $db->getQuery(true);
$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'");
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.

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.
View.jpg (17.17 KiB) Viewed 395 times

Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests