Someone mentioned to me that I need to check the collision for the player's previous position(?)
No. Someone mentioned you couldn't treat a collision as if you were going out of bounds in the current frame, because the collision didn't happen in that frame - it happened in the previous one, so not moving the player doesn't avoid a collision. It just keeps you in the same place the collision occurred.
So, the first thing to do is to stop treating it the same way, and move the player. Your code hasn't changed since the last time you posted it. You don't supply enough info for anyone to determine how to accomplish what you want, therefore you should analyze your code and figure out how to achieve your goal.