If the fence posts of your existing fence are in good shape but the fence itself isn't, you can replace the fence panels and attach them to the existing posts. To check whether your existing fence posts are in good enough shape to reuse, poke the wood with the tip of screwdriver. If the wood is soft to the touch or becomes smashed in when you touch it with the screwdriver, the wood may be rotting beneath the surface, and you shouldn't install new fence panels on it. All existing posts should be straight and level before you install the new fence panels.
Remove the old panels from the fence posts using a pry bar. Set them aside. Remove any nails remaining in the posts with the claw end of a hammer.
Use a level to make sure the posts are still straight and plumb. If a post is not straight, wiggle it into the proper position, and tamp the dirt around the post with a 2-inch by 4-inch board or a tamper. Add additional dirt around the post, if needed, to fill the hole level with the ground.
Position your first fence panel so the end of the panel is in the center of the post. Have an assistant hold up the other end of the fence post so you can install the fence panel straight. Hammer the panel through the panel and the rail to the fence post using 18d to 20d galvanized nails, or screw the panel to the posts, using a drill.
Attach the fence panel at the other rail in the same manner you attached the first. Repeat the process at the other end of the panel.
Position the next panel so it's flush against the end of the first panel. Make sure the top and bottom of the fence and the top and bottom rail on the back of the fence line up correctly. Nail or screw the panel in place.
Repeat the process until you've attached all your fence panels to your existing fence posts.