HP laptop only charge for few seconds then disconnect the charger.

Use right watts charger for the unit. Check unit's back cover for spect.  45W vs 65W or 120W