Forums

total leave does not show

elyash7 28 Sep, 2011
im working on leave management system...
and i use this code for counting the leave...

<?php
$mainframe =& JFactory::getApplication();

;
$balance   = JRequest::getString('L_totalavailable_id', '', 'post');
$balance = 15;
$mainframe->enqueuemessage('Total Leave Balance:'.print_r($balance, true).'<hr />');


$totaldays = JRequest::getString('L_totaldaysapplied_id', '', 'post');
$mainframe->enqueuemessage('Total Leave Applied: '.print_r($totaldays, true).'<hr />');


$available = abs($balance - $totaldays);
$mainframe->enqueuemessage('Current Balance: '.print_r($available, true).'<hr />');

JRequest::setVar('L_currentbalance_id', $available);
?>


and here is the email msg show
the total balance available is not showing ;(
is my code wrong?using cfv3...
GreyHead 29 Sep, 2011
Hi elyash7,

Are you using ChronoForms v4? Then this line
JRequest::setVar('L_currentbalance_id', $available);
Need to be replaced with
$form->data['L_currentbalance_id'] = $available;

Bob
elyash7 30 Sep, 2011
im using v3 btw
GreyHead 30 Sep, 2011
Hi elyash7,

Ah, OK. In that case the code should be OK. Where is it? It needs to be in the OnSubmit Before Email box.

Bob
This topic is locked and no more replies can be posted.