Weightlessness poses two main problems in the bathroom. The first is that an astronaut could drift away from the bowl at any time. But, there is a simple solution. They put 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. But, 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, so don't try it at home.
Today, astronauts actually use flushing toilets, but the toilets flush with air, instead of 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.