[ back to toc ]


Date: 2002/03/15 13:37

Hi, Peter,
Thank you very much for your response. The solution that you suggested was
the first thing that came to my mind. I've tried it before and it didn't
work. I tried it again after I got a response from you. I checked it with:
1. Print statement in the 2nd cgi form and 2. With if statement in the
second cgi form. I see that the value of variable $myname comes from HTML
file to the 1st cgi file. But the 2nd cgi. file doesn't get it.
Do you have any ideas?
Thank you again very much.

Volunteer Peter Verhas Answers

Subject Perl-CGI-HTML
Question I am a student and stuck with my assignment.
The assignment (part of it) is:
1. Create HTML file with a Form in it. One data is "myname".
2. Send it to the first *****.cgi file. This file should print out the
data from the form (smth like "your name is $myname"). This cgi file
contains another new Form with a "hidden" field. Put the name that you
received from HTML file into a "hidden" field and send it to the second
*****.cgi file.
3. The second cgi file should receive the value of $myname.
My questions are: 1.How to send the value of "myname" from the first to
the second cgi script. 2. How to print in the second cgi file smth like
"your name is $myname" (Is it possible?). 3. How to do smth like "if
(myname=John) print "Hello" else print "Good-buy"". CGI's are done in
Perl. I work on UNIX-Solaris.
Thank you very much.
Answer Creating the HTML form should be simple for you I assume. The
first CGI processes the form data, which I aslo assume you can do. The
first.cgi prints an HTML page that contains the name. This is simply a
print statement. However the printed page also contains a form that
addresses second.cgi as "action", like:

print <<<FORM;
<form action"second.cgi" method="post">
<input type="hidden" name="name" value="$myname">
<input type="submit">

assumed that the Perl variable $myname already contains the name received
from submitting the form. The second CGI gets this hidden field when the
user presses the submit button.

I hope this clarifies the issue.



there is no issue if it works or not. The technology works like that and
this it has to be done. The issue can be some programming mistake that you
have made. In that I can not help you remotely without the source code.

Try to find the bug in your code, and you will get further rather than
thinking that the problem is in the technology. It is not.


[ back to toc ]