Page 1 of 1

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

Posted: Mon Oct 05, 2009 4:37 pm
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?

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

Posted: Mon Oct 05, 2009 4:52 pm
by Mirge
Re-read the info from DB based on $id I would assume?

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

Posted: Mon Oct 05, 2009 6:26 pm
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>";

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

Posted: Tue Oct 06, 2009 6:49 am
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.

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

Posted: Tue Oct 06, 2009 2:13 pm
by Griven
It would help if you told us what the error was.