In this article, Tim will show you how to create a quick-n-easy chat script using PHP and a very simple MySQL database. The script will allow visitors to choose a nickname, enter text to send to the chatting window, and view messages from other people... all in real-time! For a bit of fun, the chat application also has buttons to send several emote-icons including smiling and frowning faces.
A MySQL Driven Chat Script - The chat script explained (contd.) (Page 4 of 6 )
The GetInput function
This function is responsible for generating the bottom frame of our chat window, and allows the user to enter their message in a text box and send it. If you look at the screen shot shown above, you will also see that the bottom frame contains a “Say” button (to submit the message), a color drop-down list (this lets the visitor choose the color of their message), and several icon-icon buttons.
The images for the icons-icons are included as part of the support material at the end of this article, and should be saved in the same directory as the chat.php script (which is also included as part of the support material).
The code for the entire GetInput function is shown below: