The most important thing to remember is to not panic and do not pull on the fabric as it'll unravel the dropped stitches even further. Quickly push your needle through any stitches you see. Don't worry about fixing them straight away, just catch as many stitches as possible. Then you can take a breath and work out a plan for fixing the problem.
Below is a video where I share how I would handle a situation like this. You can also watch the video here
It's important to practice fixing mistakes so when it happens for real, you've got the confidence to fix it. So knit a few swatches with different stitch patterns, make some deliberate mistakes, pull your needles out and then attempt to fix it. The more practice you get, the better you will become. But do remember, this is only knitting, it's not a matter of life and death. If you completely mess up, you can unravel and knit whatever it is again. I know it's dis-heartening but it's not a disaster.
I've got lots of tutorials on my Tutorials page, but these may interest you in relation to today's topic: