• 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: Additional php code by post form

Additional php code by post form 12 years 1 month ago #22112

I have made a form to calculate the BMI of somebody:

I have a form with 2 field: weight and lenght.

I put this code in the PHP script post:
print("<hr/><br/>");
                $bmi = "";
                $kwadraat = "";
                $weight= $_POST["weight"];
                $lenght= $_POST["lenght"];
                    $lenght= $lenght/ 100;
                    $kwadraat = $lenght* $lenght;
                    $bmi = $weight/ $kwadraat;
                    $bmi = round($bmi);
                    print("Your BMI is: " . $bmi . "<br/>");
                    if($bmi < 18){
                        print("<font color='blue'><b>text 1</b></font>");
                    }
                    if($bmi > 18 AND $bmi <= 25){
                        print("<font color='green'><b>text 2</b></font>");
                    }
                    if($bmi > 25 AND $bmi <= 27){
                        print("<font color='purple'><b>text 3</b></font>");
                    }
                    if($bmi > 27 AND $bmi <= 30){
                        print("<font color='yellow'><b>text 4</b></font>");
                    }
                    if($bmi > 30 AND $bmi <= 40){
                        print("<font color='orange'><b>text 5</b></font>");
                    }
                    if($bmi > 40){
                        print("<font color='red'><b>text 6</b></font>");
                    }

After fill in and submit I only get the message: The form has been submitted successfully. Thank you!

I only want to print those texts which indicates you are to light, normal weight, heavy and so on.

What do I do wrong?
Somebody to help?
Thanks!
Last Edit: 12 years 1 month ago by Mikeymore.
The administrator has disabled public write access.

Additional php code by post form 12 years 1 month ago #22246

Anybody an idea?
The administrator has disabled public write access.

Additional php code by post form 12 years 1 month ago #22279

  • upbm
  • upbm's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 34
  • Thank you received: 4
Hello,
Perhaps a simple solution:
Create a hidden field
In a script to do your calculation and assign it to the hidden field (see the documentation of calculations with numeric fields)
Now you can use this hidden field in the pdf file attached to email, or message of thanks.

Didier
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!