How to put youtube videos onto iPhone?

First off is it legal?

and i want to transfer songs from youtube onto my iphone, please explain how?

It's legal as long as you do it with only personal use. No business purpose.

You may try this YouTube downloader, I know it can help you download youtube video to computer for free. You can also use it to extract the audio from YouTube video as MP3 songs, then you can sync the mp3 songs to your iPhone through iTunes. My friends recommend it to me, it's legal and works pretty well for me.

Legal of course.
1.first download the youtube video, i think there's a tool called "free youtube downloader", i tried it for a couple times and it works OK.
2. Then convert the video to audio format (mp3 generally). There are many free online converter like Zamzar or desktop software like istonsoft video converter (totally free too).
3.last, sync the song to iphone via itunes.