<script> 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 } </script> <form action="add.php" method="POST" onsubmit="return calc()"> <input type=submit value="Calculate"> </form>
plik test.php
<?php $_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