You can either use a hand sewing needle and thread or a sewing machine (with a needle and thread). If you are using a sewing machine, you want to be sure to use the zipper foot.
First you fold the edge of the fabric over itself, (about 1/8 of an inch to 1/4 of an inch) wrong side to wrong side, so that it looks like it is hemmed and you don’t see the raw edges at the front.
Next, take your new zipper and pin it so that the fabric part (not the teeth) is underneath the folded edge (it should cover most to all of it).
Then, sew from the top of the zipper to the bottom and then repeat on the other side from top to bottom. Be sure to stitch a short line perpendicular to the sides of the zipper. Be sure to guide along the edge of the fabric.
This method also works for fixing a zipper where some of the stitching is loose or replacing it altogether.
You are now ready to enjoy your new or repaired zipper.
Note: When you are pinning the zipper, it is easier if the zipper is closed. When you are sewing, it is easier if it is open. (When you are pinning, be careful to pin only one side at a time.)