plik:
add.php
function calc() {
frm=document.forms[0]
DataToSend = "z=ce"+frm.elements['a'].value;
url="test.php"
xmlhttp.open("POST",url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.forms[0].elements['total'].value=xmlhttp.responseText
}
}
xmlhttp.setRequestHeader('Accept','message/x-formresult')
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(DataToSend);
return false
}
<form action="add.php" method="POST" onsubmit="return calc()"> <input type=text name=a value=""> <input type=text name=total value=""> <input type=submit value="Calculate">
plik
test.php<?php
if(!empty($_POST['z'])) { $_SESSION['data'] .= $_POST['z'];
}
?>
Nie znam sie kompletnie na JS wiec mam pytanie:
Jak zrobic żeby wynik pojawiał się w "Tutaj wynik" a nie w <input type=text name=total value="">.
help