01-13-2003
Hmm. Or you can better do it this way:
You can have script1 generate HTML containing a form (POST HTTP-method) with all your items specified by hidden fields, i.e. generate something like
<form action="script2.cgi" method="post">
<!-- Hidden fields -->
<input type="hidden" name="item0" value="value0">
<input type="hidden" name="item1" value="value1">
<!-- hidden fields end here-->
<input type="submit" value="submit">
</form>
When the visitor hits the submit button, the hidden fields are sent and by reading the form you can parse and get the (item0, value0), (item1, value1) pairs.
If you insist on a hyperlink, then the only method you can pass the info to script2 is by HTTP GET, i.e. on the URL as params. Script1 generates HTML containing a link with href "script2.cgi?item0&item1&..."
Your script then parses the env. variable $ENV{'QUERY_STRING'} and gets all key-value pairs to form the array again.
You will first need to convert the special characters in the array items (say @) into the % form (i.e. %40) in order to form a valid URL.
All such item mangling should be easy if you use CGI.pm.
Of course I prefer the POST method, as the URL is less noisy, and this is the method I use, right now.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hey everyone!
I hope someone here is good with Unix CGI scripts.
I'm having trouble with my CGI. Here's the deal
I've created a program that searches the passwd file and cuts the users real name when it's given the login name. When i converted it to CGI i ran into some problems:
1) when you... (3 Replies)
Discussion started by: primal
3 Replies
2. OS X (Apple)
Hello,
we have an extranet where every user has a password and a username. Some powerusers must have the possibility to access data of all the users without knowing their password. The powerusers must know the username. We want to use a form for this where a poweruser just gives the username. Then... (0 Replies)
Discussion started by: Vincent
0 Replies
3. Shell Programming and Scripting
I am not sure if you can help - but I am desparate so I will ask anyway.
I have a solaris server which I am running apache and mysql db on.
I have a basic web page (internal to my lan only)
I know some shell scripting (ksh etc) and I can create a very basic cgi script using shell scripting.
... (1 Reply)
Discussion started by: frustrated1
1 Replies
4. Shell Programming and Scripting
Hi All,
I have a web page that is a cgi script running in the cgi-bin and the script calls informatica via the command line. The problem I have is that if there is an error in the informatica workflow then exit status of my command line call does not get populated and it seems like the page is... (1 Reply)
Discussion started by: zilla30066
1 Replies
5. Solaris
Hi All,
Sorry if the question is trivial for you but, I am new to Apache (2.0.63) and am trying to figure out how to display my 400.cgi. Here is what I have in httpd.conf
servername testing
DocumentRoot "/usr/local/apache2/htdocs"
ErrorDocument 400 /cgi-bin/badrequest-400.cgi
Here is... (0 Replies)
Discussion started by: afadaghi
0 Replies
6. Web Development
Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect.
Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is
redirected to welcome page.
My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies
7. Shell Programming and Scripting
Hi team,
I have a typical problem with cgi pages in apache webserver in WINDOWS
I am able to execute(display) the pages that are saved in cgi-bin folder.
But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder.
Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies
8. Shell Programming and Scripting
Hi All,
I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet.
I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet.
print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies
9. Shell Programming and Scripting
Hello All,
first of all please forgive me if I have brocken some rule of this forum and this is not a homework :).
Could you please help me as I have created a new apache service in a server by creating a new httpd.conf for the new service. Now in the httpd.conf file I have studied by... (3 Replies)
Discussion started by: RavinderSingh13
3 Replies
10. Shell Programming and Scripting
ok so for the project i had to log in amazon node to submitted and create a captcha using cgi scripts its for a unix project this is my amazon node address ss. but first i have to create a .ht access to set the master password. can someone please help me???
in public_html, create a file... (1 Reply)
Discussion started by: jr44
1 Replies
LEARN ABOUT REDHAT
html::form
HTML::Form(3) User Contributed Perl Documentation HTML::Form(3)
NAME
HTML::Form - Class that represents HTML forms
SYNOPSIS
use HTML::Form;
$form = HTML::Form->parse($html, $base_uri);
$form->value(query => "Perl");
use LWP;
LWP::UserAgent->new->request($form->click);
DESCRIPTION
Objects of the "HTML::Form" class represents a single HTML <form> ... </form> instance. A form consist of a sequence of inputs that usu-
ally have names, and which can take on various values.
The following methods are available:
$form = HTML::Form->new($method, $action_uri, [[$enctype], $input,...])
The constructor takes a $method and a $uri as argument. The $enctype and and initial inputs are optional. You will normally use
HTML::Form->parse() to create new HTML::Form objects.
@forms = HTML::Form->parse($html_document, $base_uri)
The parse() class method will parse an HTML document and build up "HTML::Form" objects for each <form> found. If called in scalar con-
text only returns the first <form>. Returns an empty list if there are no forms to be found.
The $base_uri is (usually) the URI used to access the $html_document. It is needed to resolve relative action URIs. For LWP this
parameter is obtained from the $response->base() method.
$form->push_input($type, \%attr)
Adds a new input to the form.
$form->method( [$new] )
$form->action( [$new] )
$form->enctype( [$new] )
These method can be used to get/set the corresponding attribute of the form.
$form->inputs
This method returns the list of inputs in the form.
$form->find_input($name, $type, $no)
This method is used to locate some specific input within the form. At least one of the arguments must be defined. If no matching
input is found, "undef" is returned.
If $name is specified, then the input must have the indicated name. If $type is specified then the input must have the specified type.
In addition to the types possible for <input> HTML tags, we also have "textarea" and "option". The $no is the sequence number of the
input with the indicated $name and/or $type (where 1 is the first).
$form->value($name, [$value])
The value() method can be used to get/set the value of some input. If no input have the indicated name, then this method will croak.
$form->try_others(&callback)
This method will iterate over all permutations of unvisited enumerated values (<select>, <radio>, <checkbox>) and invoke the callback
for each. The callback is passed the $form as argument.
$form->make_request
Will return a HTTP::Request object that reflects the current setting of the form. You might want to use the click method instead.
$form->click([$name], [$x, $y])
Will click on the first clickable input ("input/submit" or "input/image"), with the indicated $name, if specified. You can optinally
specify a coordinate clicked, which only makes a difference if you clicked on an image. The default coordinate is (1,1).
$form->form
Returns the current setting as a sequence of key/value pairs.
$form->dump
Returns a textual representation of the form. Mainly useful for debugging. If called in void context, then the dump is printed on
STDERR.
INPUTS
An "HTML::Form" contains a sequence of inputs. References to the inputs can be obtained with the $form->inputs or $form->find_input meth-
ods. Once you have such a reference, then one of the following methods can be used on it:
$input->type
Returns the type of this input. Types are stuff like "text", "password", "hidden", "textarea", "image", "submit", "radio", "checkbox",
"option"...
$input->name([$new])
$input->value([$new])
These methods can be used to set/get the current name or value of an input. If the input only can take an enumerated list of values,
then it is an error to try to set it to something else and the method will croak if you try.
$input->possible_values
Returns a list of all values that and input can take. For inputs that does not have discrete values this returns an empty list.
$input->other_possible_values
Returns a list of all values not tried yet.
$input->form_name_value
Returns a (possible empty) list of key/value pairs that should be incorporated in the form value from this input.
$input->click($form, $x, $y)
Some input types (currently "sumbit" buttons and "images") can be clicked to submit the form. The click() method returns the
corrsponding "HTTP::Request" object.
SEE ALSO
LWP, HTML::Parser, webchatpp
COPYRIGHT
Copyright 1998-2000 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
libwww-perl-5.65 2001-08-01 HTML::Form(3)