Considering weight, water and weather.
What you'll need: Window box, Railing brackets, Wire, Pliers, Hardwood 2x4s that have been weather treated.
Study the railing to see exactly where the box will go. You'll want to find the areas where the railing can take the most weight.
Small window boxes are easy: many gardening stores now carry special brackets that will fit over a metal or hardwood railing.
Wide railings are even easier: place the box on top of the railing. Run the wire from the railing, under the box, and back over to the railing. Twist and knot the wire ends for security - you may need pliers to do this. Short boxes will need this done only at the ends; long boxes will need an extra wire in the middle.
Quick change options - You can set up your window box so that your can change flowers at a whim. Get very small pots with flowers already started in them. Plant the whole pot into the window box, and cover with potting soil. When you want a change, just replace the smaller pot!