• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Calculating script

Calculating script 16 years 7 months ago #4902

I have a working form I would like to add some calculations to.

The form has 6 Radio Groups each with the following \"Items\":
2, 4, 6, 8, 10 N/A

I would like to give a \"Score\" . Like 40 points out of a possible 60 would yeild 66.67%

I am starting with a test form, to develop and understand how this script calculation works before applying it to my production form.

The test from only has 2 Radio Groups with the following \"Items\":
1, 2, 3, 4, 5, N/A
I also added two hidden fields:
\"total\" and \"score\"
and of course a submit button.

Here are my scripts:
In \"Script called on form process\"

if(isset($_POST)){
$_POST = $_POST + $_POST;
}

This works and gives me the correct calculation for the total.

If I add to it

if(isset($_POST)){
$_POST = $_POST + $_POST;
}

if(isset($_POST)){
$_POST = $_POST / 10;
}

I get no results for total or score.


Any thoughts?<br><br>Post edited by: jerry1091, at: 2008/09/30 04:56
The administrator has disabled public write access.

Re:Calculating script 16 years 7 months ago #4903

I have had some success with this so far.

I added yet another hidden field \"base\"

Here is my script
if(isset($_POST)){
$_POST = $_POST + $_POST;
}

if((isset($_POST))&&($_POST>=0)){
$_POST = ($_POST + 10);
}

if((isset($_POST))&&($_POST>=0)){
$_POST = ($_POST + 10);
}


if(isset($_POST)){
$_POST = ((($_POST + $_POST ) / ($_POST)) * 100);
}


This seems to work. The only problem is if I select the radio button \"N/A\" it counts it as 0, which throws the score off.

Any suggestions?
The administrator has disabled public write access.

Re:Calculating script 16 years 7 months ago #4905

I'm going to blame it on being very tired :blink:

I replaced :
>=0)

with

!='N/A')

and all works great.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!