in reply to How do I link in CGI?
There's two different ways to do it. First, the better way (CGI.pm)
# This line loads the CGI.pm module. use CGI; # Print any error messages to the browser use CGI::Carp qw(fatalsToBrowser warningsToBrowser); my $im_better = new CGI; # You need to print a content header so you don't end up with Server 5 +00 errors print $im_better->header(); print $im_better->start_html(-title => 'Test Page'); # The coveted link print $im_better->a({href=>"http://www.google.com"}, 'Google'); $im_better->end_html();
Or you can do it quick and dirty:
print "Content-type: text/html\n\n"; # The content header ..... # Put stuff you need here print '<a href="http://www.google.com>Google</a>';
If you're also processing form results, etc., I strongly urge you to use CGI.pm.
Update: Your reply to E-Bitch leads me to believe you might be talking about redirection. In which case:
use CGI; my $im_better = new CGI; # Please note that I didn't print a header this time print $im_better->redirect("http://www.google.com");
And the quick and dirty way:
# I also didn't print a header this time either print "location:http://www.google.com\n\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I link in CGI?
by TeeHSee (Initiate) on Jul 12, 2001 at 01:07 UTC | |
by RatArsed (Monk) on Jul 12, 2001 at 13:53 UTC |