here is my code for read message but error display in my page

Notice: Undefined index: message in C:\wamp\www\.....m\Mailbox\read_message.php on line 6

anyone help me for this problem.how to solve it.

CREATE TABLE `messages` (
  `message_id` int(11) NOT NULL auto_increment,
  `from_user` varchar(65) character set latin1 collate latin1_general_ci NOT NULL,
  `to_user` varchar(65) character set latin1 collate latin1_general_ci NOT NULL,
  `message_title` varchar(65) NOT NULL,
  `message_contents` longtext NOT NULL,
  `message_read` int(11) NOT NULL default '0',
  PRIMARY KEY  (`message_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=21;
<?php
session_start();
$userfinal=$_SESSION['MM_Username'];
require "database.php";

$message_id = $_GET['message'];
$message = mysql_query("SELECT * FROM messages WHERE message_id = '$message_id' AND to_user = '$userfinal'");
$message_id=mysql_fetch_assoc($message);

echo "<h1>Title: ".$message['message_title']."</h1><br><br>";
echo "<h3>From: ".$message['from_user']."<br><br></h3>";
echo "<h3>Message: <br>".$message['message_contents']."<br></h3>";

echo '<form name="backfrm" method="post" action="inbox.php">';
 echo '<input type="submit" value="Back to Inbox">';
 echo '</form>';
?>
$_GET['message']

this variable is empty. check the spelling in the previous page from where your current page is called.

Check out the spelling of form fields in the previous page.
Confirm that the field name is 'message'

$_GET['message']

this variable is empty. check the spelling in the previous page from where your current page is called.

its previous page .

<?php
session_start();
require "database.php";
$userfinal=$_SESSION['MM_Username'];

// get the messages from the table.
$get_messages = mysql_query("SELECT message_id FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error());
$get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error());
$num_messages = mysql_num_rows($get_messages);
// display each message title, with a link to their content
echo '<ul>';
for($count = 1; $count <= $num_messages; $count++)
{

    $row = mysql_fetch_array($get_messages2);
    //if the message is not read, show "(new)" after the title, else, just show the title.
if($row['message_read'] == 0)
{
    echo '<a href="read_message.php?messageid=' . $row['message_id'] . '">' . $row['message_title'] . '</a>(New)<br>';
}else{
echo '<a href="read_message.php?messageid=' . $row['message_id'] . '">' . $row['message_title'] . '</a><br>';
}}
echo '</ul>';
echo '<form name="newmsgfrm" method="post" action="new_message.php">';
echo '<input type="submit" value="Send a New Message">';
echo '</form>';

echo '<form name="backfrm" method="post" action="index.php">';
echo '<input type="submit" value="Back to Home">';
echo '</form>';
?>

in your read message page you must use

$_GET['messageid']

see line 20 and 22 of your above code

The name is mismatching...U got it friom the previous post rt?

thanks for helping.

can you guide me for how can i insert image in my message box and i want to reply system in my script.

in your read message page you must use

$_GET['messageid']

see line 20 and 22 of your above code

i m not sure what are you asking but in your line no 13 of your topmost post, You can add img tag.

echo "<h3>Message: <br><img src='error.jpg' border=0>".$message['message_contents']."<br></h3>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.