use CGI; $q = new CGI; if ($q->param('foo')) { #do stuff if has stuff in field }else { print $q->redirect('http://www.foo.bar'); } #### if ($q->param('foo')) { #do stuff if has stuff in field }else { my $bar = $q->param('bar'); #should test this too. print $q->header; print "foo was empty please try again"; print "your html stuff here again"; #this next line keeps the info already provided. print ""; }