I have created a CGI-based page,after entering all the
values in to the fields, How to get the output on the web
browser using Perl
Answers were Sorted based on User's Feedback
Answer / guest
In the form Action you have to specify the (perl) program,
you want to execute on submitting this form.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / suvvari
In the HTML form, you have to mention the perl script name.
Ex: <form action="test.pl" method="POST">. Then in the
test.pl, you have to mention the content-type as
print "content-type: text/html\n\n";. And read the form
values and print them.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / raghav
Including the First two answers also go thru CGI.pm module.
or else you can also use the cgi-lib.pl.
Go through the docs of the modules.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / vipul dalwala
print "content-type: text/html\n\n";.
if ($ENV{’REQUEST_METHOD’} eq ’POST’) {
read(STDIN, $buffer, $ENV{’CONTENT_LENGTH’});
}
else {
$buffer = $ENV{’QUERY_STRING’};
}
@keyvaluepairs = split(/&/, $buffer);
foreach $pair (@keyvaluepairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex
($1))/eg;
print $name . "=". $value ."<br>";
}
Is This Answer Correct ? | 0 Yes | 0 No |
How do you set environment variables in perl?
How do I replace every TAB character in a file with a comma?
What does -> symbol indicates in Perl?
How do you find the length of an array?
How to replace perl array elements?
What is the use of command “use strict”?
What is the difference between perl list and perl array?
what are the three groups involved in information sharing?
How to read multi lines from a file in perl?
How to print escaping characters inside a string in perl?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
What is stdin in perl?