Yes you can use that one.
The computer should have a 40gig PATA hard drive already in. click here
You will just have to check that the jumper settings are the same; they are usually set at master.
Your problem may be the operating system, if like me; your HP has an oem disk. Then you will be fine. Just boot from cdrom and it should load. I don't think the HP hard drives are tattooed, mine loads on any HP or Compaq computer.;-)
If you just have recovery disks, you may have a problem if the old hard drive will not spin up. You would need to clone one drive to the other.