MuseiKaze Posted November 9, 2009 Share Posted November 9, 2009 Hi there. Im pretty new to php and this forum, but I was just wondering if I could get some help with part of a chat room that im writing. Basically I have a form where users enter their usernames then I want to put each username into an array and use with a session onto another page where all the users can be echoed as a list. Is this possible? Thanks =) Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 9, 2009 Share Posted November 9, 2009 Yes it is why not how is the user inputting the usernames ? what is your code till now Quote Link to comment Share on other sites More sharing options...
MuseiKaze Posted November 9, 2009 Author Share Posted November 9, 2009 I dont have anything currently for the user list section currently, I did some experimenting with adding the usernames to a text file each time someone logs in and then deleting that username when they log out, but that didnt really turn out well =P Im still all new to php, so sorry if i dont explain myself heaps well. But I was thinking something like this could be used but im not sure how to store and split each $username = $_POST['username']; into an array. index.php <form action="chat.php" method="post"> <input name="username" type="text" size="25" maxlength="20"> <input value="Login" type="submit"></form> chat.php <?php session_start(); $username = $_POST['username']; $users = array('username[0]','username[1]','username[2]'); $_SESSION['users'] = $users; ?> users.php print $users; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.