I am fairly new to all of this and am really struggling to find any examples of what I am trying to do.
all I want to create is a simple for where you enter some details and it performs a calculation on it.
I can get as far as adding and multiplying etc.. but when it comes to getting a decimal answer out I can get it to work.
and as an extra i want to use a drop down as a variable say do one calculation based on the drop down say * 1.4 if its male and * 1.01 if its female
below is what I have so far
@{
var total = 0;
var totalMessage = "";
if(IsPost) {
var age_= Request["frmage"];
var weight_ = Request["frmweight"];
var SerCre_ = Request["frmSerCre"];
var sexfactor_ = Request["frmGender"];
var age = age_.AsInt();
var weight= weight_.AsDecimal();
var SerCre = SerCre_.AsDecimal();
total = (((140-age)*weight)*sexfactor)/SerCre ;
totalMessage = "Total = " + total;
}
}
<form method="post">
<p><label for="text1">Age:</label>
<input type="text" name="frmAge" size="3"/>Years
</p>
<p><label for="text2">Weight:</label>
<input type="text" name="frmWeight" />in Kg (1st = 6.35kg)
</p>
<p><label for="text3">Serum Creatinine:</label>
<input type="text" name="frmSerCre" /> μmol/L
</p>
<p><label for="text4">Gender:</label>
<select name="frmGender" id="select">
<option value="M" >Male</option>
<option value="F" >Female</option>
</select>
</p>
<p><input type="submit" value="Calculate" /></p>
</form>
<p>@totalMessage</p>
some help im probably going about it in the completely wrong way!