There tons of possibilities, but the only thing that both the floppy drive and CD drives have in common is a sensor switch that tells the computer they have media installed and are ready for use.
If they aren't used regularly, those sensor switches can get dirty or "freeze up" so they don't properly report a ready status.
Possibly you can get them to work by cycling the drives several times -- insert a disk and remove it repeatedly -- and work the "stickiness" out of the sensor switches.
If that doesn't work, take your computer to a professional for diagnosis. A professional has diagnostic software that most of us don't have. I suspect that you may be told you need to replace the drives.