in reply to Re^2: a "search engine" (ahem)
in thread a "search engine" (ahem)

Use escapeHTML from CGI. Or a template system that has the option to escape interpolated variables.