Purchase a special railing planter. These planters are divided up the bottom middle so they can hang directly on the railing without any special hardware -- and showcase your flowers on both sides of the rail.
Drill a small hole about 1 inch down one side of a standard plastic pot. If your railing is wood, you can hang it from a nail or hook you install in the wood. If it is metal, purchase an "S" hook that will go over the rail and hold onto the pot.
Use a rectangular planter that either comes with, or can be attached to, a railing bracket. These brackets attach with screws to the planter, and then hook over the railing.
Secure the planter you have chosen to the railing.