Can anyone with a PhD write a textbook? I think I have a few questions here.
I've said this before: I don't have many talents, but I can teach, and I can teach very well. Education is my passion and that is one of the reasons I am pursuing my PhD (that, and the fact that I love doing math eight hours a day).
This being said, can anyone with a PhD write a textbook? Or do you have to be well-known in the field and have lots of papers published? What if I write a really good textbook- will nobody buy it because my name is not known?
Anyone with or without a PhD can write a text book. Yet independently of how well-known the author is, text books are not particularly well-selling items, since the audience is very narrow.  And even if they sell well, you will certainly not get any significant money from the sales.
If you want to write a text book for teaching purposes and because you think you can write a high-quality text book, then do it, go ahead.  Yet its popularity will probably grow if you make electronic copies available for free.
I am writing two text books at the moment, yet not in English, so I expect the audience to be fewer than 100 people. :-) However, I am still writing them because they will be nearly the only textbooks on that topic in this language, and people have already been very thankful for the drafts.