[svlug] Perl/cgi question...

Robert Khachikyan rkhachik at sdsio.jpl.nasa.gov
Thu Oct 18 11:33:01 PDT 2001


I call the script from an html page:
<form action="https://cgi-bin/request1a.pl?action=requesta" method="POST"
NAME="requesta">
<input name=fname type="text">
		.
		.
		.
<INPUT type="submit" value="Next" NAME="requesta"
ENCTYPE="application/x-www-form-urlencoded">
<INPUT type="reset" value="Reset">

The other parameters are working. For instance, the param('fname') would
print
the first name of the user...and so on.
Only the param('action') is not working. And that is because it's not a
field
that's being filled in. It's passed by the submit button.

At the top of the script, I have:
#!/usr/local/bin/perl -Tw

use CGI qw/:standard :html :netscape :param/;
$q = new CGI;
use HTML::FillInForm ();
$fif = new HTML::FillInForm;


I've also tried printing the value of param('action'):
print $q->header();
print $q->start_html(-title=>'TEST');
print $q->p("\$\_ is $_  ");
$par = param('action');
print $q->p("par is $par  ");

the output it generates is:
$_ is (nothing)
par is (nothing)

1 weird thing that happens is that on the address bar,
I type the filename.pl?action=requesta?fname=john?lname=doe
the output is :
$_ is
par is requesta?fname=john?lname=doe

However, $_ remains nothing while the value of $par is changed.

Thanks for the reply. However, any suggestions?

...Robert

-----Original Message-----
From: jeremy siu [mailto:ksiubong at lycos.com]
Sent: Thursday, October 18, 2001 11:16 AM
To: svlug svlug
Cc: Robert Khachikyan
Subject: Re: [svlug] Perl/cgi question...


How did you test your cgi-script? Did you test it from the html pages or run
the
cgi-script like this
" HTTP_METHOD=POST perl -w filename.pl action=requesta "?
Is all the other param('whatever') not working too?
Or only the param('action') not working?
Do you have this line "use CGI qw(param);" in your script?
Have you tried to print the value of "param('action')" , and see you
actually get anything ?

Sai Pong Siu
--

On Thu, 18 Oct 2001 10:04:58
 Robert Khachikyan wrote:
>Dear community,
>
>I just joined the group and don't know if I should be asking a perl/cgi
>group.
>But I'll ask in any case...
>
>
>I'm writing a perl/cgi script that a user fill's in a form
>consisting of first_name, last_name,etc.etc.etc., then they press submit.
>It takes them to another page and then they choose a username & passwd
>for future log-in's. After verifying the validity of the username & passwd,
>I take them to another page and ask them other sorts of questions, and so
>on...
>
>Initially, I had 1 script that checked the validity of the first_name &
>last_name
>& phone#,etc.etc.etc. Then the same script would ask the user to choose a
>username
>& password on another html page. When it was filled out, the submit button
>would
>direct to another perl/cgi script where the validity was checked and then
to
>other
>pages...
>
>I just got a request to converge all this scripts into 1. One way of doing
>it is via
>CASE statements. From the initial html page, I have a
>filename.pl?action=requesta
>where the function requesta performs the validity of the first_name &
>last_name,etc.etc.etc.
>My problem is that the param('action') is not passed into $_. In fact, when
>I say
>'print $_', it prints nothing. Here is that part of the code:
>
>$_ = param('action');
>CASE: {
>     /^requesta/i and do       {requesta(); last CASE; };
>     /^requestb/i and do       {requestb(); last CASE; };
>
>    #default CASE
>     default();
>}
>
>sub requesta { perform the validity of fname & lname...}
>
>
>when I say print $_, the output is nothing.
>If there's something I'm doing wrong, please help if you can. Thanks.
>If there are additional info's I can provide, please don't hesitate to ask.
>
>...Robert
>
>
>_______________________________________________
>svlug mailing list
>svlug at lists.svlug.org
>http://lists.svlug.org/lists/listinfo/svlug
>


Make a difference, help support the relief efforts in the U.S.
http://clubs.lycos.com/live/events/september11.asp





More information about the svlug mailing list