The best way is to run XP 32bit within 7 32bit or XP 64bit within 7 64bit.
If their architecture (32bit or 64bit) is different then programs that use device drivers won't work properly.
For example, if you're running XP 32bit inside 7 64bit all your devices are still run through 7 even though you're trying to access them in XP.
They software in XP require 64bit drivers but those drivers won't then be compatible with XP 32bit.
The other way is to have a dual boot PC, as I have recently finally managed to do, so your PC is effectively two separate computers which you can't run both at the same time.
But you can have one system in 32bit and one in 64bit (if your chipset supports 64bit).
This is handy as the 32bit system only needs 32bit drivers and the 64bit system only needs 64bit drivers.
However, installing an older system onto a PC that already has a newer system is very tricky.
You'll need a copy of the XP install disc.
A very useful tool for this is EasyBCD from NeoSmart Technologies (which is free if you get the non-commercial version)
http://neosmart.net/EasyBCD/
Have a read up on it while you're there.
The only way to have a fully functioning 32bit system along side a 64bit system on a 64bit machine is to use the dual boot method and treat them as different computers.
Be aware though that certain hardware manufacturers won't provide device drivers for older operating systems on newer machines.
Hopefully all that makes some sort of sense.