Helpful Information
 
 
Category: HTML FORM
HTML form -> Perl -> HTML form ???

Hi,
I am trying to return response from perl script to the HTML form. Those HTML form and perl file are located on a different servers. Form 1 is sending text to the form.pl file. File is processing that text. But, I do not know how to return response from perl file to the HTML form 2. Can somebody help me with this?

The script for HTML form is

<HTML>
<HEAD>
<TITLE>HTML form/TITLE>
</HEAD>
<BODY>
<FORM NAME="form1" ACTION="http://www.domain.com/cgi-bin/form.pl" METHOD="POST">
<INPUT TYPE="TEXT" NAME="Test" VALUE="" SIZE="18" MAXLENGTH="50"> <br>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Go!">
</FORM>

<FORM NAME="form2" METHOD="POST">
is: <INPUT TYPE="TEXT" NAME="Test" VALUE="" SIZE="16" MAXLENGTH="50">
</FORM>
</BODY>
</HTML>


The script for perl file form.pl is


#!/usr/bin/perl -w
print "Content-type: text/html\n\n";

use LWP::Simple;

$a = <STDIN>;

# Do something simple
$b = substr ($a, 5, length($a)-18);

# print "Befor $a\n";
# print "After $b\n";

# How to return $b results to the Form 2

I'm unclear on what you're trying to do. Are you asking how to take a form submission via a perl script, and then print some of the results out into a different form?

I'm unclear on what you're trying to do. Are you asking how to take a form submission via a perl script, and then print some of the results out into a different form?

Ctb,
Yes. This is my question.
Those forms should be the HTML forms and located on the same page.
So, user should see submitted value in HTML form 1 and returned by perl script results in HTML form 2.

Something like this:

Submitted by user Name: John Smith
Returned by perl script Your name is: Johh

Can you help me with this?

The CGI and HTML::Template modules will be able to help you. CGI will allow you to easily access the incoming form data. HTML::Template will allow you to embed special tags on the HTML page in question that can be used to fill in data when it is available.

Once you've taken a look at the documentation for these two modules and played around with some examples, if you have any specific questions feel free to continue posting them in this thread.