I found this code which makes a BMI Calculator (Form) for me however when I click on submit it takes the user back to the index page ie. domain.com/index.php. How do I change it to go to, say, domain.com/calculator.php ? The code is below:
<?
/**
* @package Module Body Mass Index Calculator for Joomla! 1.5
* @version $Id: mod_bodymassindexcalculator.php 599 2010-03-20 23:26:33Z you $
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
$heightcm=$_POST["heightcm"];
$weightkg=$_POST["weightkg"];
if ($heightcm!="" && $weightkg!="") {
$heightm = $heightcm / 100;
$bmi=round($weightkg / ($heightm*$heightm),1);
echo "Heigth, m: ".$heightm."<br />";
echo "Weigth, kg: ".$weightkg."<br />";
echo "Body Mass Index (BMI): ".$bmi."<br />";
echo "<strong>";
if ($bmi<16.5) {echo "Severely Underweight</strong><br />";}
if ($bmi>=16.5 && $bmi<=18.4) {echo "Underweight</strong><br />";}
if ($bmi>=18.5 && $bmi<=24.9) {echo "Normal</strong><br />";}
if ($bmi>=25 && $bmi<=29.9) {echo "Overweight</strong><br />";}
if ($bmi>=30 && $bmi<=34.9) {echo "Obese Class I</strong><br />";}
if ($bmi>=35 && $bmi<=39.9) {echo "Obese Class II</strong><br />";}
if ($bmi>=40) {echo "Obese Class III</strong><br />";}
echo "<br />";
}
$domain = $_SERVER['HTTP_HOST'];
$path = $_SERVER['SCRIPT_NAME'];
$queryString = $_SERVER['QUERY_STRING'];
$url = "http://" . $domain . $path;
$url3 = "http://" . $domain . $_SERVER['REQUEST_URI'];
$mystring1="?";
$s1=strpos($url3,$mystring1);
if($s1==0) {$url2=$url3;}
if($s1!=0) {$url2=substr($url3,0,$s1);}
$path = $url2;
//1 foot = 0.3048 meters
//1 inch = 2.54 centimeters
//1 pound = 0.45359237 kilograms
$n1=230;
echo "<table style=\"width: 100%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr><td valign=\"top\">";
//echo "<h3>BMI Calculator</h3>";
echo "<form action=\"".$path."\" method=\"post\" >";
echo "<strong>Height</strong><br />";
echo "<select name=\"heightcm\" >";
for ($i=30; $i<=$n1; $i++){ echo "<option value=\"$i\">".$i." cm / ".floor($i / 30.48)." ft ".round(($i-(floor($i / 30.48)*30.48)) / 2.54, 1)." in </option>";}
echo "</select>";
echo "<br />";
echo "<strong>Weight</strong><br />";
echo "<select name=\"weightkg\" >";
for ($i=30; $i<=$n1; $i++){ echo "<option value=\"$i\">".$i." kg / ".round($i / 0.45359237,2)." pounds </option>";}
echo "</select>";
echo "<br />";
//echo "<input name=\"searchterm\" type=text size=\"27\" class=\"ns1\">";
echo "<br />";
echo "<input type=\"submit\" value=\"Calculate\" name=\"B1\">";
echo "</form><br />";
//DON'T REMOVE THIS LINK - DO NOT VIOLATE GNU/GPL LICENSE!!!
echo "<a href=\"http://nutritioncaloriecounter.com\">Nutrition Calorie Counter</a>";
//DON'T REMOVE THIS LINK - DO NOT VIOLATE GNU/GPL LICENSE!!!
echo "</td></tr></table>";
?>