Safely handle different search forms