Create unique tar archives from a list of directories

I'm looking to archive a client directory from a CIFS share

There are multiple directories that will be stored in a text file and I'm looking to
create an individual tar archive of each folder in the directory.

I've tried a number of commands to no avail.

Here's what I would like.

text file contents

dirA
dirB
dirC

output:

dirA.tar
dirB.tar
dirC.tar

This command appears to work but the tar file isn't created in my current directory.

for i in `cat textfile`; do tar cvf $i.tar $i; done

*Update*
I did some more testing while typing this and figured out that if I change $i.tar to test.tar, the archive is created. I would like the archive to have the name of the directory that is being archived.

Any ideas of a better way to accomplish this?

It worked fine for me in Linux. May be you could try using the current directory path as below

 for i in dir{1..4} ; do tar cvf  ./$i.tar ./$i; done

Thanks but my problem is that the text file contains directories in other filesytems. When I run this script, it's creating the tar within the directory it's tarring.

for i in `cat textfile`; do tar cvf $i.tar $i ; done

I want it stored in my current directory. So when I change it point to my current directory, i get an error.

for i in `cat textfile`; do tar cvf ./$i.tar $i ; done
tar: .//path/to/directory.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Anyone?

---------- Post updated at 08:10 PM ---------- Previous update was at 07:45 PM ----------

I got the solution...

for i in `cat textfile.txt`; do tar -cf ${i##*/}.tar $i; done