runnerjp Posted June 25, 2008 Share Posted June 25, 2008 hey guys i have my pm sytem up and working great but im just adding a few things to it... on my profile's page i have added <a href="http://www.runningprofiles.com/members/index.php?page=compose&user=$user">Send <?php echo $user; ?> a message</a> but how can i check on my compose page that if there is a user=$userr in the address it just adds user if not it does this <?php $username= get_username($_SESSION['user_id']); $query = "SELECT * FROM `friends` WHERE `username`= '$username' ORDER BY username ASC;"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ $friends[]= $row['friendname'];} $friends; $lines = $friends;; echo '<select class="input" id="username" name="username">'; foreach($lines as $line) { echo '<option>'.$line.'</option>'; } echo '</select>';?> (select from the drop down list) see what im trying to do... so you can send users a message from the profile field, or you can compose your own by selecting the friends name Link to comment https://forums.phpfreaks.com/topic/111854-solved-sending-users-pms/ Share on other sites More sharing options...
DoddsAntS Posted June 25, 2008 Share Posted June 25, 2008 Hi, you can either have the user variable in the link select the appropriate user from the drop down list, or if there is a user sent have it add a hidden field to the form instead of the select box for the first option (Selecting the appropriate user from the select list //snip foreach($lines as $line) { $selected = isset($_GET['user']) ? ($_GET['user'] == $line ? ' SELECTED' : '') : ''; echo "<option{$selected}>{$line}</option>"; } //snip and for the second option <?php if(isset($_GET['user'])) { echo "<input type='hidden' name='username' id='username' value='{$_GET['user']}' />"; } else { //enter your code for generating the select } ?> Link to comment https://forums.phpfreaks.com/topic/111854-solved-sending-users-pms/#findComment-574177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.