johnnys Posted February 11, 2014 Share Posted February 11, 2014 Hi Guys, I'm just starting to work with Fabrik & Joomla, and need help with a some custom calculation. Quick question regarding two drop down boxes I am creating a form for past pupils of a school. First drop down box is called 'Year of Leaving' {member_app_year_out} and offers options from '1930' right through to '2014' (lots!). Second drop down box is called 'Membership Type' {member_app_type} and offers two options 'Full Membership £20' and 'Reduced Membership £10'. I want the second drop down box (Membership Type) to be dependant on the selection from the first drop down box. The rule is that 'If you have left the school within the past 7 years, you qualify for a Reduced Membership of £10'. So I want users to select e.g. 2008 and only see 'Reduced Membership', and users who select e.g. 2001 to only see 'Full Membership'. This also needs to update each year. How can I do this? Something like if {member_app_year_out} = '(now)' - 7 Apologies for my lack of programming knowledge, I'm learning. Thanks in advance, J Quote Link to comment Share on other sites More sharing options...
Barand Posted February 11, 2014 Share Posted February 11, 2014 If they only ever get a single option, why have an option dropdown at all? Quote Link to comment Share on other sites More sharing options...
Solution possien Posted February 11, 2014 Solution Share Posted February 11, 2014 As Barand indicated, let your calculation take care of the fee. Getting the year from their input you could use something like: <?php $years = strtotime('-8 years'); $ref_date = date('Y', $years); echo '<br />'; echo $ref_date.'<br/>'; $date_left = 2000; //example date from the form echo $date_left. '<br />'; if($date_left > $ref_date){//if less than 8 years it must be 7 or less $membership = 10;}// if less than 8 else $membership = 20;//if more than 7 echo $membership; ?> Use the $membership as the fee. Quote Link to comment Share on other sites More sharing options...
johnnys Posted February 12, 2014 Author Share Posted February 12, 2014 thanks guys i will give this a go Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.