Ah, chat rooms. I've implemented this in greater or lesser degrees four times, with http forms and http-refresh, with ajax and with websockets. It's a fun thing to do.

This one looks pretty all right.

A few comments:
The php code:
It's better, I think, to use isset to check if a value has been set rather than empty.
The mysql_* interface has been depricated. That said, I think you should use mysql_real_escape_string rather than addslashes to escape content in mysql queries.
It might be better to identify owners of rooms by sessions rather than IP as more than one computer can share the same (internet) IP

The app:
When you type out a message and hit enter, it should automatically delete the message you just wrote from the input field.