http://www.perlmonks.org?node_id=89376


in reply to C any bugs?

Above comments withstanding, here it goes:

Change this:

if ($query->param()) { $search_name = $query->param('search_name'); ...
into:
if( $search_name = $query->param('search_name') ) { ...
If the param('search_name') is empty/fails, it will return a blank string, '', which perl treats as a false value, i.e., if condition fails. Same effect as before, a little clearer.

Why are you doing <BR> and \n here? \n won't have any real effects on the html(usually), so it's not needed. Unless, I presume, you need to edit it, and this is for 'beautification purposes'. If you really want/need to line breaks, try <p>. This is where I'm talking about:

print "$name<BR>\n$email<BR>\n$comments<BR>\n<HR>\n";

Major Recommendation: Look up CGI.pm's HTML handling abilities! Especially its abilities with forms. It'll make your pages a lot less error prone, and the CGI a lot more bearable/easier to read for larger examples. For example, <title>this is the title</title> can be re-written, assuming $q is a cgi object, as $q->title("This is the title"). CGI will automatically add an /title, or end whatever tag, as needed. Look into it.

Replies are listed 'Best First'.
Re: Re: C any bugs?
by dimmesdale (Friar) on Jun 18, 2001 at 21:53 UTC
    This was my post(I guess I got logged out somehow). Just thought I'd clear up any confusion.