Jump to content


Photo

Multiple-PMS


  • Please log in to reply
3 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 16 September 2006 - 09:53 AM

Hey!
I've got a small Private Messaging system, And I would
like to allow a larger box so people can send Pms to more
then one member, I wanted it so they ahve to separate
each member by a ','.

I have the basic idea on how to do it following my "array"
which is used to delete PM's with tick boxes, but that would
mean I will have to have more than one text box, it is quite
confusing...

If anyone could help. I would apreciate it.
- Thanks!
-- Ash

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 16 September 2006 - 10:05 AM

well you would use somthing like

$users=explode(', ',$_POST['users']);
foreach($users as $user) {
//code here and each user will be in the variable $user
}


regards
liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 16 September 2006 - 10:19 AM

that means i would need more than 1 text box with the name "users[]"
I wanted one textarea which allows them to separate each user by
a comma or one user per line :/

#4 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 16 September 2006 - 12:08 PM

yeah that's what that does because it explodes you normal box e.g. named users and then it explodes by ', ' so a comma and a space and creates an array called $users so in users we now have all the users with no comma and then the foreach $users as $user will rip each user out of the array and run what ever command u wish on them.

put the code working here http://www.ukchat.ws...reaks/users.php

so e.g. code

<form action="" method="post">
Users: <input type="text" name="users">
<input type="submit" name="submit" value="submit">
</form>
<?php
$users=explode(', ',$_POST['users']);
foreach($users as $user) {
echo $user.'<Br>';
}

?>


Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users