I want to add number of confirmed forms from users. Every time they use the form it will show their order number - different for every logged in user.
I've adden hidden field "counter" and in Script called on form process i added code:
$db = JFactory::getDbo(); $query = $db->getQuery(true); $user = JFactory::getUser(); $db->setQuery("SELECT SUM(`confirmed`) AS suma FROM `#__rsform_submissions` WHERE `UserId`='id';"); $_POST['form']['counter'] = $db->loadResult()+1;
It shows 1 all the time.
So I want to show sum + 1 of confirmed submisions from logged in user. How can I change the code to make it tow work?