onthespot Posted August 15, 2009 Share Posted August 15, 2009 Hey guys, I have a fully functional messaging system. What I am now trying to do is provide a direct link on users profiles for them to PM someone. Obviously this would bring up the new_message.php page, but the dropdown menu would have the player that they want to message automatically selected. How would I go about doing this? What code would I need to supply for you to help me on this? Thanks Link to comment https://forums.phpfreaks.com/topic/170384-pm-question/ Share on other sites More sharing options...
DarkendSoul Posted August 15, 2009 Share Posted August 15, 2009 One possibility is to have the link point to new_message.php?user={USERNAME_HERE} then for the new_message.php file have it so the value for the "To" input box contains <?php echo $_GET["user"]; ?> Link to comment https://forums.phpfreaks.com/topic/170384-pm-question/#findComment-898798 Share on other sites More sharing options...
onthespot Posted August 15, 2009 Author Share Posted August 15, 2009 Yeah thats a way I could use. Is there a way to select a user from the dropdown menu already on offer though? Link to comment https://forums.phpfreaks.com/topic/170384-pm-question/#findComment-898802 Share on other sites More sharing options...
onthespot Posted August 15, 2009 Author Share Posted August 15, 2009 If i did that, when they want to send a message just from the pm system itself without the GET, would it just default to the top of the list? So would doing it your way in effect make the dropdown select the correct player? How would this work if i wanted to reply? Use the from part of the message and GET that too? Link to comment https://forums.phpfreaks.com/topic/170384-pm-question/#findComment-898803 Share on other sites More sharing options...
onthespot Posted August 15, 2009 Author Share Posted August 15, 2009 <?php $res=mysql_query("SELECT username FROM ".TBL_USERS." WHERE username != '".$_SESSION['username']."'") or die(mysql_error()); while($row=mysql_fetch_assoc($res)){ $username=htmlspecialchars($row['username']); echo "<option value=\"$username\">$username</option>"; } ?> This is my existing code which brings up all users from my database. Howver I want to be able to reply to messages, or put links on profiles for SEND PM, to that specific user. How could I edit this code so that it will preselect the appopriate user from the dropdown? Link to comment https://forums.phpfreaks.com/topic/170384-pm-question/#findComment-898836 Share on other sites More sharing options...
onthespot Posted August 15, 2009 Author Share Posted August 15, 2009 anyone? Link to comment https://forums.phpfreaks.com/topic/170384-pm-question/#findComment-898846 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.