how to read message on the next page by clicking on the sub.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

how to read message on the next page by clicking on the sub.

Post by adsegzy »

am designing a social website where friends can send message to one another. i have designed the indox page named inbox.php where list of all messages will be displayed. the inbox table will display the SENDER, SUBJECT and DATE. the subject the an hyperlink that will direct the member to read the message. I also design another page named readmsg.phpwhere the message which subject is being clicked in the inbox.php will be read, this page will show the SENDER, DATE SENT, SUBJECT & MESSAGE. the code for the subject is as below

Code: Select all

<a href="readmsg.php?id=$id">$subject</a>

The problem is that whenever the subject is being clicked in the inbox.php, i will be directed to readmsg.php but the field of SENDER, DATE SENT, SUBJECT & MESSAGE will be blank it won't show the info. i tried to create and pass it to SESSION[read] but its now working because i already have a SESSION[member]. please what do I do?
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: how to read message on the next page by clicking on the sub.

Post by Mirge »

Re-read the info from DB based on $id I would assume?
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: how to read message on the next page by clicking on the sub.

Post by Griven »

adsegzy wrote:

Code: Select all

<a href="readmsg.php?id=$id">$subject</a>
If that's the exact code that you're using, then it won't work. You're mixing HTML and PHP without any concatenation and/or escape characters. Try this:

Code: Select all

echo "<a href=\"readmsg.php?id=$id\">$subject</a>";
adsegzy
Forum Contributor
Posts: 184
Joined: Tue Jul 28, 2009 9:26 am

Re: how to read message on the next page by clicking on the sub.

Post by adsegzy »

Hello Griven, thank you for your help, but when i click on the link its not leading to the readmsg.php, its giving me error. please is there any other better way? please let me know.
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: how to read message on the next page by clicking on the sub.

Post by Griven »

It would help if you told us what the error was.
Post Reply