结果将保存并显示在第一页上,但在第2页上显示:
"+javavar+"
我应该在输入
中准备好文字page1.php中:
<html>
<body>
<input onkeyup="jstophp()" onpaste="jstophp()" id="text">te</input>
<script>
function jstophp(){
javavar=document.getElementById("text").value;
document.getElementById("rslt").innerHTML="<?php
session_start();
$var='"+javavar+"';
echo $var;
$_SESSION['test'] = $var;
?>";}
</script>
<div id="rslt">
</div>
</body>
使page2.php:
<?php
session_start();
$text = $_SESSION['test'];
echo $text;
?>