Buttons (controlls) and graphics handle on browser. With javascript, there is lot of drawing libraries, well, even game libraries (craftyjs, gameQuery ...).
State a current game has will be on server in a database.
table players {id, name, score, actual_game_id ...}
table games {id, name, player_which_is_on_move_id, ... remaining_time (for example) ... }
table card {id, game_it_belongs_to_id, which_player_has_him_in_hand_id, value ...}
table message {id, game_where_it_was_sent_id, player_who_send_it_id, text, ...}
I derived this from thinking about entity relations (may contain mistakes):
player can play only one game, game has N players
card belongs to only one player, player can have N cards
card belongs to only one game, each game has its own cards (so they are not mixed btw games)
only one player is allowed to move at a time
...
Communication between player and server is trough AJAX. Player side is coded in javascript, server side in PHP (or similar) + SQL. One problem is that You have to periodically ask/query (chat made by periodical query in AJAX) server whether something new happened (server can not contact You trough AJAX); there might be a way to let server contact You trough something else than polling with AJAX, but I do not know what it is.
- A player sends server messages like "can I play?", "my username and password is ...", "I am moving this card", "I am sending this message to a chat window > hi folks, this game rocks!" ...
- Server determines whether and how to change database (add message to message table, save the move to tables if it is valid).
- Player periodically queries server "has something new happened", for example when he is waiting for move of a other players.
You have to figure out rules of communication (communication protocol). Also there is a chance, that some of javascript game libraries has methods to help You handle communication.