Hallo Freunde,
ich habe folgendes Formular geschrieben!
Mein Problem bei diesem Code ist folgender:
Wenn ich zwei Nachrichten, oder mehr in meiner Inbox habe, kann ich ohne Probleme auf eine Nachricht antworten, nur nicht auf die Erste!
Denn dort wird auf die Mutter-Action zugegriffen, wie könnte ich das Problem umgehen?
ich habe folgendes Formular geschrieben!
Code:
<?php $title = "Michael Senger - Inbox" ?>
<?php date_default_timezone_set("Europe/Berlin") ?>
<?php require_once("style/top.php"); ?>
<div id="content">
<div id="full">
<?php
if($username)
{
echo "<a href='create_message.php'>Create a new Message</a>";
//INBOX
require_once("scripts/connect.php");
$query = mysqli_query($con, "SELECT * FROM messages WHERE to_user = '$username' ORDER BY id DESC");
$numrows = mysqli_num_rows($query);
if($numrows != 0)
{
echo "<form action='delete_message.php' method='post'>
<table cellspacing='5px' cellpadding='5px'>
<tr style='background-color: lightgrey;'>
<td><input type='checkbox' name='selectall' /><input type='submit' name='deleteinbox' class='button' value='delete' /></td>
<td width='100px'>From Username</td>
<td width='100px'>Subject</td>
<td>From</td>
</tr>";
WHILE($row = mysqli_fetch_assoc($query))
{
$msg_id = $row['id'];
$msg_to_user = $row['to_user'];
$msg_to_id = $row['to_id'];
$msg_from_user = $row['from_user'];
$msg_from_id = $row['from_id'];
$msg_subject = $row['subject'];
$msg_content = $row['content'];
$msg_date = $row['date'];
$msg_from_delete = $row['from_delete'];
$msg_to_delete = $row['to_delete'];
if(!$msg_to_delete){
echo "<tr>
<td><input type='checkbox' name='cb$msg_id' value='$msg_id' /></td>
<td><a href='profile.php?id=$msg_from_id'>$msg_from_user</a></td>
<td>
<span class='toggle' onClick='return false'><a href='#'>$msg_subject</a></span>
<div id='hiddenDiv'>
$msg_content
<br />
<br />
<span class='toggle'><a href='#' onClick='return false'>Reply</a></span>
<div id='hiddenReply'>
<form action='reply.php' method='post'>
<table>
<tr>
<input type='hidden' value='$msg_id' name='replyid' />
<td>Subject:</td>
<td><input type='text' name='replysubject' value='RE: $msg_subject' size='41'></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name='replycontent' rows='5' cols='32'></textarea></td>
</tr>
<tr>
<td></td>
<td><input type='submit' name='replybutton' value='Reply'></td>
</tr>
</table>
</form>
</div>
</div>
</td>
<td>$msg_date</td>
</tr>";
$num += 1;
}
}
if($num == 0)
{
echo "You have no messages in your inbox.";
}
echo "</table>
</form>";
}
else
{
echo "You have no messages in your inbox.";
}
//OUTBOX
require_once("scripts/connect.php");
$query = mysqli_query($con, "SELECT * FROM messages WHERE from_user = '$username' ORDER BY id DESC");
$numrows = mysqli_num_rows($query);
if($numrows != 0)
{
echo "<form action='delete_message.php' method='post'>
<table cellspacing='5px' cellpadding='5px'>
<tr style='background-color: lightgrey;'>
<td><input type='checkbox' name='selectall' /><input type='submit' name='deleteoutbox' class='button' value='delete' /></td>
<td width='100px'>To Username</td>
<td width='100px'>Subject</td>
<td>From</td>
</tr>";
WHILE($row = mysqli_fetch_assoc($query))
{
$msg_id = $row['id'];
$msg_to_user = $row['to_user'];
$msg_to_id = $row['to_id'];
$msg_from_user = $row['from_user'];
$msg_from_id = $row['from_id'];
$msg_subject = $row['subject'];
$msg_content = $row['content'];
$msg_date = $row['date'];
$msg_from_delete = $row['from_delete'];
$msg_to_delete = $row['to_delete'];
if(!$msg_from_delete)
{
echo "<tr>
<td><input type='checkbox' name='cb$msg_id' value='$msg_id' /></td>
<td><a href='profile.php?id=$msg_from_id'>$msg_from_user</a></td>
<td>
<span class='toggle' onClick='return false'><a href='#'>$msg_subject</a></span>
<div id='hiddenDiv'>
$msg_content
</div>
</div>
</td>
<td>$msg_date</td>
</tr>";
$num += 1;
}
}
if($num == 0)
{
echo "You have no messages in your inbox.";
}
echo "</table>
</form>";
}
else
{
echo "You have no messages in your outbox.";
}
}
else
{
echo "<center>You must be logged in to view this page.</center>";
}
?>
</div>
</div>
<?php require_once("style/bottom.php"); ?>
Wenn ich zwei Nachrichten, oder mehr in meiner Inbox habe, kann ich ohne Probleme auf eine Nachricht antworten, nur nicht auf die Erste!
Denn dort wird auf die Mutter-Action zugegriffen, wie könnte ich das Problem umgehen?
Kommentar