There are different ways to do this. What style fence is it and what material is it made of? What type of planter do you want? You can buy them at most hardware/home goods stores, either to hold round pots or rectangular flower boxes. They will screw directly into a post or crossmember or they have a hook type hanger. Here are some ideas from Pinterest. if you find one you like, we can advise you on how to make it.
Wood or steel/iron fence?
How long do you want it?
They are fairly inexpensive to purchase, normally just a few dollars. Is this what you were thinking? https://amzn.to/2KIjuGM
Here are few different ideas: