#!/usr/bin/perl
use strict;
use warnings;
use CGI qw(:all);
#Create a new CGI object
my $cgi = new CGI;
my $this_url = $cgi->url(); #Save this script's url
my $first = $cgi->param('first_name');
my $last = $cgi->param('last_name');
print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Generating Self-Referential URLs</title></head>
<body>
<FORM action="$this_url" method="POST">
First Name: <input type="text" name="first_name">
Last Name: <input type="text" name="last_name">
<input type="submit" value="Submit">
</FORM>
<p>The name you entered was '$first $last'</p>
</body>
EndOfHTML
#Put a comment or linefeed after EndOfHTML
#Otherwise perl might not find it.
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159
The following works for me.
my $this_url = $cgi->url();
Don't put anything between the parentheses. You put the full path to your script file and Apache doesn't understand that. The $cgi->url() method should retrieve the correct url for the script that you are running, so that when you submit your form it should go to the same script containing that form. You can read about this at OBTAINING THE SCRIPT'S URL
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159
Hi,
Thanks for your help...i got the output. thanks for your coding
You're welcome. Please don't forget to mark this thread 'solved'.
d5e5
Practically a Posting Shark
810 posts since Sep 2009
Reputation Points: 159
Solved Threads: 159