i did one simple task.
but values are not holding after submit. how to solve this problem.
below is my code. after interest field submit the form. automatically displays the monthly payment. but that value is not holding in the field.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript" type="text/javascript">

function MonthsOfYears()
var years = window.document.formx.years.value;
window.document.formx.mnths.value=years * 12;
function YearsOfMonths()
var mnths=window.document.formx.mnths.value;
function find_payment(PR, IN, PE) {
var PAY = (PR * IN) / (1 - Math.pow(1 + IN, -PE))
return PAY
function validate()
var principal = window.document.formx.amount.value;
var interest = (window.document.formx.irate.value)/100;
var term = window.document.formx.years.value;
var monthly_payment = find_payment(principal, interest / 12, term * 12)

//alert("Amount of the loan:\t$" + principal + "\n" +
//"Annual interest rate:\t" + interest * 100 + "%\n" +
//"Term of the mortgage loan:\t" + term + " years\n\n" +
//"Monthly payment:\t$" + monthly_payment)

//--> End of hidden JavaScript for Browsers not supporting it

<form name="formx" method="post" onsubmit="return validate();">
                                            <td width="110">
                                                Mortgage amount:
                                                <input gtbfieldid="23" name="amount" size="9"  class="small" type="text">

                                            <td width="110">
                                                Mortgage term:
  <input gtbfieldid="24" name="years"   class="small mar10 marLeft" onblur="return MonthsOfYears();" type="text">
  &nbsp;&nbsp;years or
  <input gtbfieldid="25" name="mnths"   class="small marNoRight" onblur="return YearsOfMonths();" type="text">
  &nbsp;&nbsp;months                                               </p>
                                            <td valign="top">
                                                <span class="form-error" id="errnrOfYears"></span>                                                

                                            <td width="110">
                                                Interest rate:
                                                <input gtbfieldid="26" name="irate"  id="ctl00_well_DefaultUC_interestRate" class="small mar10 marLeft" type="text">
                                                &nbsp;&nbsp;% per year<span class="form-error" id="errinterestRate"></span>
                                                <span id="ctl00_well_DefaultUC_lblerrinterestRate" class="form-error fs11"></span>  

                                            <td> </td>
                                            <td valign="top">
                                            <td width="110">

                                                <p>Mortgage start date:
                                                <select gtbfieldid="27" name="month" id="ctl00_well_DefaultUC_LoanMonth" class="mar10 marLeft">
	<option selected="selected" value="1">Jan</option>
	<option value="2">Feb</option>
	<option value="3">Mar</option>
	<option value="4">Apr</option>

	<option value="5">May</option>
	<option value="6">Jun</option>
	<option value="7">Jul</option>
	<option value="8">Aug</option>
	<option value="9">Sep</option>
	<option value="10">Oct</option>

	<option value="11">Nov</option>
	<option value="12">Dec</option>

                                                <select gtbfieldid="28" name="date" id="ctl00_well_DefaultUC_LoanDate">
	<option value="1">1</option>
	<option value="2">2</option>
	<option value="3">3</option>

	<option value="4">4</option>
	<option value="5">5</option>
	<option value="6">6</option>
	<option value="7">7</option>
	<option value="8">8</option>
	<option value="9">9</option>

	<option value="10">10</option>
	<option value="11">11</option>
	<option value="12">12</option>
	<option value="13">13</option>
	<option value="14">14</option>
	<option value="15">15</option>

	<option value="16">16</option>
	<option value="17">17</option>
	<option value="18">18</option>
	<option value="19">19</option>
	<option value="20">20</option>
	<option selected="selected" value="21">21</option>

	<option value="22">22</option>
	<option value="23">23</option>
	<option value="24">24</option>
	<option value="25">25</option>
	<option value="26">26</option>
	<option value="27">27</option>

	<option value="28">28</option>
	<option value="29">29</option>
	<option value="30">30</option>
	<option value="31">31</option>

                                                <select gtbfieldid="29" name="year" >

	<option value="1987">1987</option>
	<option value="1988">1988</option>
	<option value="1989">1989</option>
	<option value="1990">1990</option>
	<option value="1991">1991</option>
	<option value="1992">1992</option>

	<option value="1993">1993</option>
	<option value="1994">1994</option>
	<option value="1995">1995</option>
	<option value="1996">1996</option>
	<option value="1997">1997</option>
	<option value="1998">1998</option>

	<option value="1999">1999</option>
	<option value="2000">2000</option>
	<option value="2001">2001</option>
	<option value="2002">2002</option>
	<option value="2003">2003</option>
	<option value="2004">2004</option>

	<option value="2005">2005</option>
	<option value="2006">2006</option>
	<option value="2007">2007</option>
	<option value="2008">2008</option>
	<option value="2009">2009</option>
	<option selected="selected" value="2010">2010</option>

	<option value="2011">2011</option>
	<option value="2012">2012</option>
	<option value="2013">2013</option>
	<option value="2014">2014</option>
	<option value="2015">2015</option>
	<option value="2016">2016</option>

	<option value="2017">2017</option>
	<option value="2018">2018</option>
	<option value="2019">2019</option>

                                                <span class="form-error" id="errLoanStartDate"></span>

                                            <td class="fB fcBlue" width="110">
                                                Monthly Payments:
                                                <input gtbfieldid="30" name="mnthpay"   type="text" >
                                                <span class="form-error" id="errmonthlyPayment"></span>

                                            <td colspan="2" align="center">
                                <div >
                                                   <input type="submit" name="submit" value="calculate" />


It's not holding because the form is getting submitted. Return false in javascript function "validate".

It's not holding because the form is getting submitted. Return false in javascript function "validate".

ok......up to there problem solved. but when i am refreshing the page how the values will hold in the same fields.

When you hit submit, If you want to retain the values, you can do this.

<input type='text' name='username' value='<?php echo (isset($_REQUEST['username']) ? $_REQUEST['username'] : ""); ?>'>

This will check if $_REQUEST is set. If yes, it will echo it in the form field. Else, it will echo '' [null].