52,797
社区成员
发帖
与我相关
我的任务
分享
function searchbutton(){
var str = document.getElementById("textarea").value;
if(str != null){
alert(str);
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
window.location.href = "function/search.php";
}
}
xmlhttp.open("get","function/search.php?text="+str,true);
xmlhttp.send();
}
}
<?php
session_start();
$_SESSION['searchtext'] = $_GET["text"];
echo "欢迎来到搜索界面!";
echo "您搜索的内容为:".$_SESSION["searchtext"];
?>