Win 3.x is dependent on DOS, and requires the Microsoft CD extensions (MSCDEX.EXE) to be installed, and a CD-ROM driver that will work with the CD-ROM drive.

Like Steve, I'm wondering why you're wanting to install Win95 over the top of 3.1 - if the 95 is an upgrade version, I'd think you should be able to boot a floppy disk with CD-ROM support, run the 95 setup and show it the Win 3.x media when requested.