It may sound silly, but it's really a good question, because weightlessness does make a visit to the latrine a tricky proposition.
Weightlessness poses two main problems in the bathroom. The first is that an astronaut could drift away from the bowl at any time. However, there is a simple solution. The astronauts strap on thigh and foot restraints in order to go to the john!
The second dilemma is a bit more complicated. Here on earth, gravity assures that our waste falls downward, away from the body. However, under weightless conditions, body waste has the disconcerting tendency to hover close to wherever it exited the body. On the earliest space flights, astronauts had to tape a bag to their bodies to catch the waste, but that got pretty messy.
Today, astronauts actually use flushing toilets, that actually flush with air, rather than water. First, the air flow draws the waste away from the body, then flushes it into storage tanks. All of the liquid waste from the spacecraft is stored together in a holding tank, which is periodically dumped overboard, where the liquid evaporates.
Solid waste, on the other hand, goes into a container that's exposed to the vacuum of space. The vacuum completely dries out the solid waste, which is taken back to earth for disposal.