Menu
Hi
I know this is possble, I have been doing some seaching with no luck.
I have a webapge with a form and when the user clicks the enter button I want text to appear on the the page.
( I know how to do this buy setting the form action to say”page.php” and code that page to transfer the values.
Not shure how to do it so that it adds to the same page
any thoughts
thank you
[code=php]
<?php
//page.php
if(isset($_GET['pagecomments'])){
echo("<b>" . $_GET['pagecomments'] . "</b>");
}else{
?>
<form action="page.php" action="get">
<input type="text" name="pagecomments" style="width: 200px;">
<input type="submit" value="submit">
</form>
<?php
}
?>
[/code]
<i>
</i>var ratespread = (interestRate - (remainingTermInterestRate /100) - bonus);
var IRD = ratespread * mortgageBalance * diffMonths
<i>
</i>
<label for="interestRate">
Mortgage Interest Rate:
<input id="interestRate" name="interestRate" type="text" value="" />
</label>
<label for="interestRate">
Rate Discount:
<input id="bonus" name="bonus" type="text" value="" />
</label>
[code=php]
<?php
//page.php
if(isset($_GET['pagecomments'])){
echo("<b>based on the value of " . $_GET['interestrate'] . " the interest rate spread is " . $_GET['bonus'] . "</b>");
}else{
?>
<form action="page.php" action="get">
<label for="interestRate">
Mortgage Interest Rate:
<input id="interestRate" name="interestRate" type="text" value="" />
</label>
<label for="interestRate">
Rate Discount:
<input id="bonus" name="bonus" type="text" value="" />
</label>
<input type="submit" value="submit">
</form>
<?php
}
?> [/code]
[code=html]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function appendInputToBody(input_object)
{
newParagraph = document.createElement('p')
newParagraph.appendChild(document.createTextNode(input_object.getElementsByTagName('input')[0].value))
document.getElementsByTagName('body')[0].appendChild(newParagraph)
/* Clear the text box */
input_object.getElementsByTagName('input')[0].value = ''
return false;
}
</script>
<title>Append</title>
</head>
<body>
<form action="" method="POST" onsubmit="return appendInputToBody(this)">
<p><input type="text" name="whatever"></p>
<p><input type="submit" value="Append node"></p>
</form>
</body>
</html>[/code]
[code=html]
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=ISO-8859-1">
<META NAME="keywords" CONTENT="">
<META NAME="description" CONTENT="">
<META NAME="ROBOTS" CONTENT="ALL">
<title>Mortgage Penalty Calculator</title>
<script src="../javascript/lendingrates.js" type="text/javascript"></script>
<script type="text/javascript">
function compute(mortgagePenalty){
var mortgageBalance = parseInt(document.mortgagepenalty.mortgageBalance.value);
var termStartDate = document.mortgagepenalty.termStartDate.value;
var termLength = document.mortgagepenalty.termLength.value;
var bonus = (document.mortgagepenalty.bonus.value)/100;
var interestRate = parseInt(document.mortgagepenalty.interestRate.value)/100;
//var remainingTermInterestRate = parseInt(document.mortgagepenalty.remainingTermRate.value)/100;
var cashbackdollars = parseInt(document.mortgagepenalty.cashbackdollars.value);
//---- Three Months Interest ---------------------
var threeMonthsInterest = Math.round(100*[(mortgageBalance * interestRate)/4]/100);
var usrDate = new Date(termStartDate);
var curDate = new Date();
var usrYear, usrMonth = usrDate.getMonth()+1;
var curYear, curMonth = curDate.getMonth()+1;
if((usrYear=usrDate.getFullYear()) < (curYear=curDate.getFullYear())){
curMonth += (curYear - usrYear) * 12;
}
var diffMonths = curMonth - usrMonth;
if(usrDate.getDate() > curDate.getDate()) diffMonths--;
//---------Interest Rate Differential------------
var ratespread = (interestRate - (remainingTermInterestRate /100) - bonus);
var IRD = ratespread * mortgageBalance * diffMonths
var penalty;
if(IRD > threeMonthsInterest)
penalty = IRD
else if (IRD < threeMonthsInterest)
penalty = threeMonthsInterest;
//-------- cash back repayment-----------
var cashbackrepayment = cashbackdollars * ([termLength - diffMonths]/termLength)
}
//----------------------------------------
fN = "mortgagepenalty"; //form name
eN = "yesNo"; //radio name
vV = 0; //visible value (for radio)
tN = "cashbackdollars"; //toggle input name
lI = "cashback"; //label id
function togInp() {
var val = document.forms[fN].elements[eN][vV].checked;
val = (val==true) ? "yes" : "no";
if (val=="yes") {
document.forms[fN].elements[tN].style.visibility = "visible";
document.getElementById(lI).style.visibility = "visible";
} else if (val=="no") {
document.forms[fN].elements[tN].style.visibility = "hidden";
document.getElementById(lI).style.visibility = "hidden";
}
}
</script>
<style type="text/css" media="all">
@import "../css/main.css";
@import "../css/mortgagepenaltycalculator.css";
</style>
</head>
<?php include("../header.html"); ?>
<body>
<div id="outer">
<div id="sub">
<div id="center">
[code=php]
<?php
//mortgagepenaltycalculator.php
if(isset($_GET['pagecomments'])){
echo("<b>based on the value of " . $_GET['interestRate'] . " the interest rate spread is " . $_GET['bonus'] . "</b>");
}else{
?>
[/code]
<div id="footer">
<p>Copyright © TomorrowNextweek.com</p>
</div>
</div>
I did not want to post all my code because its quite long. I have not been doing a vary good job at explaining myself.[/QUOTE]Is there a question or problem hidden in this post somewhere. Read
submit button the page flashes but none of the data is written to the to the page.[/QUOTE]Is it supposed to do something in javascript? Or in the subsequent PHP page. If the Javascript is to do anything at all it will need an event handler.
[code=php]if(isset($_GET['pagecomments'])){ [/code]
[code=php]if(isset($_GET['interestrate'])){ [/code]
0.1.9 — BETA 6.16