如何显示来自用户和管理员的消息?

时间:2014-02-18 08:17:51

标签: php html

这是我的mysql数据库。这是id,姓名,电子邮件,消息,回复消息的行

id |名字|电子邮件|消息| reply_message

这是我的管理消息php的代码

<b>Messages:</b><br/>
<?php
//Connect to your database....
$con=mysqli_connect("localhost","root","","u517914012_data");
$contact_array = mysqli_query($con,"SELECT * FROM contact ORDER BY email ASC");
while($row = mysqli_fetch_array($contact_array))
{
echo"Email: ";
echo $row['email'];
echo"<br/>";
echo"Message: ";
echo $row['message'];
echo"<br/></br>";
}
?>
<br/><br/>
<b>Reply Users:</b>
<form name="form" id="form" action="user-panel.php" method="post">
Email:<input type="text" name="email" class="" maxlength="100" /><br/>
Message:<textarea name="reply_message" rows="5" cols="45" class=""></textarea>
<input type="submit" value="Submit">
</form>

这是我的用户消息php的代码

    <div id="formbox"> 
        <form name="form" id="form" action="message/submit.php" method="post">
            <ul id="ngothastyle3">
                <li>
                    <label>Name</label>
                    <input type="text" name="name" class="" maxlength="40" />
                </li>
                <li>
                    <label>Email</label>
                    <input type="text" name="email" class="" maxlength="100" />
                </li>
                <li>
                    <label>Message</label>
                    <textarea name="message" rows="5" cols="45" class=""></textarea>
                </li>
                <li>
                    <label>&nbsp;</label>
                    <input type="submit" value="Submit">
                </li>
            </ul>
        </form>            </div>

<b>Admin Reply Info:<b><br/>

<table class="admin-table" border='1' style="position:relative; left:80px;font-size:13px;">
<tr>

<span style="position:relative; left:520px; font-size:20px; background :url('images/admin-header.png');">Creator Studio Admin Panel</span>
<hr width="104%">
<?php
$email=$login_session;
$req = mysql_query('SELECT email,reply_message FROM booking_members WHERE email ="$email ');

while($dnn = mysql_fetch_array($req))
{
?>
    <tr>    
        <td class="left" >
        &nbsp<?php echo htmlentities($dnn['reply_message'], ENT_QUOTES, 'UTF-8');?>&nbsp
        </td>               
    </tr>
<?php
}
?>
</table>
是的,请有人帮助我。问题出在用户消息php。

1 个答案:

答案 0 :(得分:0)

$req = mysql_query('SELECT email,reply_message FROM booking_members WHERE email ="$email ');

替换为

$req = mysql_query("SELECT email,reply_message FROM booking_members WHERE email ='$email'  ");