admin管理员组文章数量:1422062
i have a website that provides chat service. i made member-information page for every member in chat. i want to display member-information to anyone who clicked at username in chat.
for example:
jack
hi
jhon
hi
jack
i'm jack
jhon
i'm jhon
here is the header
$chat_messages_html .= '<li>' . '<span class="chat_message_header">' . '<a href="meeting/member_info">' . $chat_message->username . '</a>'
my problem how to get variable $chat_message->username in member information page to use it to retrieve information
i hope it is clear
i have a website that provides chat service. i made member-information page for every member in chat. i want to display member-information to anyone who clicked at username in chat.
for example:
jack
hi
jhon
hi
jack
i'm jack
jhon
i'm jhon
here is the header
$chat_messages_html .= '<li>' . '<span class="chat_message_header">' . '<a href="meeting/member_info">' . $chat_message->username . '</a>'
my problem how to get variable $chat_message->username in member information page to use it to retrieve information
i hope it is clear
Share Improve this question edited Apr 21, 2012 at 15:51 Jasper 11.9k6 gold badges39 silver badges56 bronze badges asked Apr 21, 2012 at 15:15 user1327157user1327157 7551 gold badge6 silver badges4 bronze badges2 Answers
Reset to default 5Add user id to link:
$chat_messages_html .= '<li>' .
'<span class="chat_message_header">' .
'<a href="meeting/member_info?userid=' . $userid . '">' .
$chat_message->username .
'</a>'
Then you can retrieve user id using $_GET["userid"]
in meeting/member_info.php
.
And please consider using htmlspecialchars()
to escape dangerous content.
You can pass it through the query string:
'<a href="meeting/member_info?username="' . $chat_message->username . '">' . $chat_message->username . '</a>'
本文标签: phphow to pass variable through a href tagStack Overflow
版权声明:本文标题:php - how to pass variable through a href tag - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745343033a2654351.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论