How to build a gate on my front porch?

The porch opening is 6 foot wide and I would like a gate to keep my dog from running off. The posts on either side are 4x4 posts. I would like to build a wood gate with 2x2's but am not sure if I need something stronger for support? Also, how do I latch it? If I use 2 gates that come together at the middle will I need slide latches on both sides so that if the dog jumps up on it the gate will not come unlatched?

  3 answers