in reply to Displaying an Error
the redirect goes back to your original html page. Make sure you don't print anything to the browser before the if to make the redirect work.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 "<input type=text name=bar value=$bar>"; }
|
|---|