㈠ 求一步一步教php留言板製作方法

1. 先設計數據表,一般留言板需要兩個表:留言內容表、回復表

留言內容表:messages
欄位如下:
id 自動增加
contents 留言內容
messages_time 留言時間

回復表:reply
欄位如下:
id 自動增加
messages_id 關聯messages表的id
contents 回復的內容
reply_time 回復時間

2. 設計留言板頁面及保存留言數據

大概代碼如下:

<form name="form1" method="post" action="index.php?action=ok">
<texarea cols="30" rows="10" name="contents">
</textarea>
<input type="submit" value="提交">
</form>

<?php
if($_GET['action'] == 'ok'){
$contents = $_POST['contents'];
mysql_query("insert into messages values(NULL,'".$contents."',now())");
}
?>

3. 顯示留言內容,遍歷數據表

<?php
//包含數據連接代碼
require('data.php');
$query = mysql_query("select * messages");
while($array = mysql_fetch_array($query)){

echo $array['contents']."<br>";
}
?>

4. 回復的設計可以參照留言的設計

㈡ 使用PHP腳本製作一個簡單的留言板、跪求教程!!

下載軟體 XMPP === 用途:搭建php環境
系統 貌似現在的電腦基本上都能實現,除非你的回電腦很老很老
安裝萬答軟體後瀏覽器輸入localhost/phpmyadmin
1、建立留言數據表
2、建立留言欄位
->留言內容
->留言作者
->留言時間
3、寫php代碼和寫html頁面實現留言
(2)php製作留言板擴展閱讀是PHP教程,不懂的可以去多看看,不是一言兩語就能說清楚的

㈢ php留言板的回復怎麼做

首先得設計好資料庫,留言一個表,回復一個表,然後把留言表中關鍵內字ID關聯到回復表中容。
比如:
留言表:message
id
contents
user
time
回復表:reply
id
m_id 關聯留言表中的id
contents
user
time

然後程序方面把對應的留言、回復保存到相應的表中,讀取的時候先遍歷留言表,然後通過留言表id再讀取對應的回復數據。

㈣ 如何用php做出登陸注冊留言板

用php做出登陸注冊留言板:

<form id="form1" name="form1" method="post" action="<?php echo site_url()."/publish/user_message"?>">
<textarea rows="5" cols="50" name="huifu" <?php if($uere_name == "0"){echo "disabled";}?> >
<?php
if($uere_name == "0")
{echo "抱歉你還沒登錄不能進行留言";}
?>
</textarea>
<input class="wole" name="author" value="<?php echo $author;?>" /><!--接受方帖子作者-->
<input class="wole" name="news_id" value="<?php echo $news_idx;?>" /><!--文章id-->
<input type="submit" name="Submit"/>
</form>
<script language="javascript">
function updateinfo(){
if(<?php echo $uere_name;?> == 1){
document.form1.Submit.value = "留言";
document.form1.Submit.disabled = false;
}
else{
document.form1.Submit.value = "還未登錄";
document.form1.Submit.disabled = "disabled";
}
}
updateinfo();
</script>

回復帖子:

<p>這里是<?php echo $is;?>樓 用戶:<?php echo $sel->receiver_author;?> <br />留言內容:<?php echo $sel->content?>


<a onClick="showdiv('contentid<?php echo $is;?>','showtext<?php echo $is;?>')" href="javascript:void(0)">回復</a>
<div id="contentid<?php echo $is;?>" class="none">
<?php
$query = $this->db->query("select * from message where son_id ='$sel->id' order by id");//獲取指定父id的子回復
$revis = $query->result();
foreach($revis as $row){?>
<p><?php if($row->sender_author == $row->receiver_author){echo $row->sender_author;}
else{ echo $row->sender_author."回復了:".$row->receiver_author;}?>
內容是:<?php echo $row->content?></p>
<?php }?>
<form action="<?php echo site_url()."/publish/son_message"?>" method="post">
<input name="son_idx" class="wole" value="<?php echo $sel->id?>" />
<input name="receiver_author" class="wole" value="<?php echo $sel->receiver_author;?>" />
<input class="wole" name="news_id" value="<?php echo $news_idx;?>" /><!--文章id-->
<textarea rows="5" cols="50" name="huifux"></textarea>
<br><input type="submit" name="sub" value="回復"></form></div></p>
<script language="JavaScript" type="text/JavaScript">
<!--
function showdiv(targetid,objN){

var target=document.getElementById(targetid);
var clicktext=document.getElementById(objN)

if (target.style.display=="block"){
target.style.display="none";
clicktext.innerText="回復";

} else {
target.style.display="block";
clicktext.innerText='收起';
}
}
-->
</script>

效果圖:

㈤ 想寫個PHP留言板,請問要怎麼做

1. 先設計數據表,一般留言板需要兩個表:留言內容表、回復表
留言內容表:messages
欄位如下:
id 自動增加
contents 留言內容
messages_time 留言時間
回復表:reply
欄位如下:
id 自動增加
messages_id 關聯messages表的id
contents 回復的內容
reply_time 回復時間
2. 設計留言板頁面及保存留言數據
大概代碼如下:
3. 顯示留言內容,遍歷數據表
4. 回復的設計可以參照留言的設計

㈥ php+mysql做留言板

shouye.php

?php

include"conn.php";

$sql="select*fromroomsorderbyid";

$query=mysql_query($sql);

while($row=mysql_fetch_array($query)){?>

<ahref="message.php?id=<?phpecho$row["id"]?>"><?phpecho$row["name"];?></a>

<?php}?>

messages.php

<?php

$room_id=$_GET["id"];

include"conn.php";

echo"<br>";

if(isset($_POST["sub"])){

$hid=$_POST["hid"];

$content=$_POST["content"];

$sql="insertintomessages(room_id,content,sent_at_datetime)values('".$hid."','".$content."','".time()."')";

$query=mysql_query($sql);

$sql_rooms="select*fromroomswhereid!='".$hid."'";

$query=mysql_query($sql_rooms);

while($row=mysql_fetch_array($query)){

?>

<ahref="message.php?id=<?phpecho$row["id"]?>"><?phpecho$row["name"];?></a>

<?php

}

}

$sql_mess="select*frommessageswhereroom_id='".$room_id."'";

$query=mysql_query($sql_mess);

while($row=mysql_fetch_array($query)){?>

<?php

$date=$row["sent_at_datetime"];

echo$row["content"]?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?phpechodate("Y-m-dH:i:s",$date+8*60*60);echo"<br>";?>

<?php}?>

<formmethod="post"action="message.php">

<inputtype="textarea"name="content">

<inputtype="hidden"name="hid"value="<?phpecho$room_id?>">

<inputtype="submit"name="sub"value="留言">

</form>

時間好像是不對,水平拙劣,希望能幫到你,共同進步!!!

㈦ 用PHP怎麼做留言板

我來教你:
首先你要建立一個mysql資料庫
然後在資料庫裡面設置欄位 例如 用戶 留言
當你在html頁面的文本框填寫留言後,用表單點擊提交(在表單裡面要設置提交到那個頁面 比如:index.php)
當你提交到改頁面後,在這個頁面填寫你的php代碼
就是連接資料庫,然後將你的留言寫進資料庫
最後查看 和刪除 就是執行資料庫常見的查詢功能和刪除功能了

㈧ PHP+mysql做一個留言板

先select 你的留言板 內容 送入數組 result
然後循環for($i=0;$i<count($result);$i++){$result[$i]['question_no'] = $i+1;} 然後前台調foreach循環的 question_no 只有思路 具體你要自己寫

第二個問題 問錯了 如果循環對的話 和 div 對應的話 不會出錯的 你要自己檢查你是否寫對沒

㈨ php留言板製作

你確定你的標點符號是對的?

比如:

$title=$_POST[`title`];

$con=$_POST[`con`];

還有標題<inputtype=`text`size=20name="title"value="<?phpecho$rs[`title`]"><br>

內容<textarearows="5"cols="50"name="con"><?phpecho$rs[`contents`]></textarea><br>

你再確定你的變數引用是正確的?

比如:set`title`='title'

大哥,你的語法錯得不得了啊?

你不但沒有php的基礎,連html的基礎都沒有

標點符號都用不對!

主要體現在引號和反引號上!

<?php
include_once'conn.php';
$Sub=$_POST['submit'];
if(!empty($Sub)){

$title=$_POST['title'];
$con=$_POST['con'];
$sql="update`liuyanban`set`title`='{$title}',`content`='{$con}'";

echomysql_query($sql)?'ok':mysql_error();

}
?>
<formaction="add.php"method="post">

標題<inputtype="text"size=20name="title"value="<?phpecho$rs['title']"/><br/>
內容<textarearows="5"cols="50"name="con"><?phpecho$rs["contents"];?></textarea><br>

<inputtype="submit"name="submit"value="發布留言"/>
</form>

㈩ 如何用php做留言板。

<!-- 表單-->
<form method="post" action="本頁" >
<input type="表單元素" name="重要">
其他的表單略過這里只講原理
</form>
<$conn=mysql_connect ("伺服器",用戶,密碼);
$mysql_select_db=「資料庫」;
$a=$_post[重要];
.
.
.
把上面表單中的元素全部獲取。
$query="insert into 表名(欄位1,欄位2.。。。) value($a,$b........)";
mysql_query($query);
>
以上是主要過程。中間還有表單驗證沒有添加