Not all toilets are 12" mounts (which will be the minimum distance from the wall that the toilet can be installed. Measure from the wall to the center of the hole in the floor (generally the bolts are the same distance as the center of the hole). Some toilets, because of their design need more clearance from the wall than others, so make sure you get the right kind.
Also, if your bathroom floor is tile, there is probably more distance from the drain flange to the surface of the floor, and you should use a double-high wax ring to ensure a good seal between the toilet and drain.
I'm not a plumber, but have replaced a few toilets in my time.