trek road bike puncture and then gears stop working advice needed? I wonder if any one can help me I have a trek road bike, I have had it several years and it has always worked really well gears changing well and never had a puncture.

A couple of weeks ago I went out for a ride and back wheel went bang and had a puncture. I took back wheel off and replaced inner tube and put back wheel back on.

I started cycling again and every thing seemed fine then I heard a strange snapping sound and when I tried to change gears right shifter would not work so could not change gears. I had to ride home with one gear.

When I got home I checked bike and found out gear cable had snapped.

Today I replace broken gear cable and other gear cable. I decided to change brake cables as well.

When I had finished every thing was working well all gears were changing smoothly, brakes working fine.

I decided to take it out for a ride to test. Every thing was going well then I heard a bang again another puncture. I took off back wheel replaced inner tube, pumped up and put wheel back on. I Started riding and every thing seemed fine gears changing fine.
2 minutes later right gear shifter stops working again.

I have checked over bike and gear cable has not snapped it is fine. gear shifter just does not seem to be working the levers for going up and down dont click when moved they just move around and do nothing.

Have I done some thing wrong when I changed the gear cable. Left shifter is working fine. and as I said after I changed gear cables both shifters were working fine and gears were changing smoothly until puncture.

Why do my gears suddenly keep stopping working each time I get a puncture.
and any advice on what I can do to try and fix.

Im beginning to think im jinxed my last bike a carrera kept getting continual punctures every bike ride some times two or 3 times in one ride. I tried replacing inner tubes and tyres. but it made no difference so gave up in the end and bought the trek which has been great until now.

Sorry if this is long any advice would be much appreciated

thanks in advance
The lever not clicking when moving makes me think your shifter could be broken, but that does seem like an unlikely coincidence.

Shifter broken test: The way to test this is follow the cable down from the shifter and at the first place where the cable emerges from the housing, put your left hand under the bare cable and pull on it so there is tension on the cable.  With your other hand, shift up and down.  The clicks may get more audible, and hopefully you can feel the cable tighten and loosen with each shift.  If you feel the clicks in the cable tension, your shifter is fine and you can move to the next steps.

Housing popped out of cable stops test:  The way to find out is first "shift" your shifter into the hardest to pedal gear to release cable tension, then follow the cable from the shifter down to the derailleur. 
Check that the beginning and end of all the little plastic-covered pieces of housing are in their cable stops (the metal cylindrical pieces attached to the frame that hold the housing in place).
If one of the housing pieces has popped out, pop it back in and it should shift again.  You may need to manually push the rear derailleur cage towards the spokes to release the tension so you can get the housing back in.

Cable slipped test: Another possibility is the cable has slipped and pulled through the derailleur fixing bolt (the bolt that attaches the cable to the derailleur).
In this case, you would again "shift" the shifter to the hardest to pedal gear to reduce cable tension, loosen the bolt, pull on the end of the cable till there is no slack and re-tighten the cable.  The shifting should begin to work again.

It should be one of those cases, although a piece of housing could have splintered and you'll see small wires popping out of it.  If so, replace the housing.

Worst case, take it to a bike shop :)