Home >Backend Development >PHP Tutorial >php同页面传值如何写

php同页面传值如何写

WBOY
WBOYOriginal
2016-06-13 10:23:10819browse

php同页面传值怎么写?
我想要的效果是


    do { ?>

//标题


    } while ($row_Recordset_task = mysql_fetch_assoc($Recordset_task));
 ?>



//在这里显示标题所相关的内容,内容在在、数据库的值为$row_Recordset_task['csa_text']





------解决方案--------------------
你是不要页面刷新么 那就用ajax 或者笨点的方法就是做个跟原来页面样式一样的新页面 跳转到这个新页面 跟原来的界面差不多 视觉上好像是没刷新一样
------解决方案--------------------
同意楼上 用ajax!!!
------解决方案--------------------
PHP code
<?php /* Created on [2012-5-16] Author[yushuai.niu] */#查询标题信息$sql="select * from table";    $res=mysql_query($sql);    if(!$res) die("SQL: {$sql} <br>Error:".mysql_error());    if(mysql_affected_rows() > 0){        $titles = array();        while($rows = mysql_fetch_array(MYSQL_ASSOC)){            array_push($titles,$rows);        }    }?>
=$row_Recordset_task['csa_title']?>
<script>//Ajaxvar xmlHttp; function createXMLHttpRequest() { if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } function record(id){ createXMLHttpRequest(); url = "action.php?id="+id+"&ran="+Math.random(); method = "GET"; xmlHttp.open(method,url,true); xmlHttp.onreadystatechange = showList; xmlHttp.send(null); } function show(){ if (xmlHttp.readyState == 4){ if (xmlHttp.status == 200){ var text = xmlHttp.responseText; document.getElementById("show").innerHTML = text; }else { alert("response error code:"+xmlHttp.status); } } }</script>Error:".mysql_error()); if(mysql_affected_rows() > 0){ $rows = mysql_fetch_array(MYSQL_ASSOC); } print_r($rows); mysql_close();}?>
------解决方案--------------------
学习了
探讨

PHP code

/* Created on [2012-5-16] Author[yushuai.niu] */
#查询标题信息
$sql="select * from table";
$res=mysql_query($sql);
if(!$res) die("SQL: {$sql}
Error:".mysql_error());
if(mys……
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn