[svlug] Perl/cgi question...
jeremy siu
ksiubong at lycos.com
Thu Oct 18 12:10:01 PDT 2001
The easiest way to fix this problem is to add:
<input type="hidden" name="myaction" value="requesta">
in your form, and use param('myaction') instead.
Get rid of the "action=requesta " in your
<form action="https://cgi-bin/request1a.pl?action=requesta"............
You can just use <form action="https://cgi-bin/request1a.pl" method="POST" ......
I don't know if you can use that 'action' in the <form action="ci......... .
I never tried something like that before. I always use "hidden" input type to pass key word to my cgi-script.
Sai Pong Siu
--
On Thu, 18 Oct 2001 11:32:03
Robert Khachikyan wrote:
>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
>
>
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