The only way that i have been able to give my son medicine, before he now (thankfully) drinks out of the measuring cup, was to hold him on the floor and give it to him. The method is as follows:

place him on his back and straddle his chest so i am on my knees over him and put both of his hands above his head and hold his hands together with one of my hands. His arms prevented him from moving his head side to side.

use a syringe type measuring applicator to get it past his lips and give him very small amounts so he would swallow it. If i gave him too much he would spit it all out.

when the medecine is all in him, pick him up, wipe off any medecine that missed, and give him hugs to calm him down as he was usually upset by this time.

Believe me i know it is not real nice to force a child to take medicine like this but i find it much worse for his stubbbornness to keep him from getting better. they also learn what you are doing so by the second time it comes to give them a dose be prepared for the fit throwing and crying to start as soon as you try to give them any medecine.