passing variables

i have this form which has predefined names and values embedded in it, but there are some values that the user can enter... i want to write a script that logs and/or emails those variables and then plug them into another script... kinda like:
http://mydomain.com/cgi-bin/welcome.pl?&name=USERINPUT&name=predefinedvalue&name=USERINPUT&name=value etc

if anyone could give me tips on how i could do this or if i'm making any sense (i've just begun learning basic perl and cgi stuff) or just point me in the right direction, it'd be a great help!
LVL 1
sayhiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
If I am understanding you, it sounds like you want to set a
Location:
header, or a <META HTTP-EQUIV="REFRESH"> tag
Or else fetch the URL yourself, which can be be done with perl modules like
use LWP::Simple;
or
use LWP::UserAgent;
0
MotazCommented:
If you use FrontPage Express you can
drop a Submit button, and at forms properties click Settings then write your CGI executable file at Action edit box, select method of sending these values (Post or Get) I prefere Post, because it is more secure, by it you can send password, but you cann't if you use Get, because the password will appear at Address area. when the user open this page and enter some data in different fields then he/she click on Submit button all these data will be sent to your CGI or PERL application.

Motaz
0
KennyIT Application ExecutiveCommented:
Hope this helps you out :

####### In your HTML :

<form method=post action=script.pl>


######## In your CGI :

#!/usr/bin/perl

#
# To handle input from forms / URL
#


#Putting the Query_string into a variable
      if ($ENV{'REQUEST_METHOD'} eq POST)
            {
            $DataLength=$ENV{'CONTENT_LENGTH'};
            read (STDIN, $QueryString, $DataLength);
            }
      else
            {
            $QueryString = $ENV{'QUERY_STRING'};
            }

#Splitting the pairs and putting them in a list
      @NameValuePairs = split (/&/, $QueryString);

#Preparing for HTML stuff
      open (LOG, ">>log.txt");
      print "Content-type: text/html","\n\n";      # MIME header

      print "<HTML>","\n";
      print "<HEAD>","\n";
      print "<TITLE>","Parameters sent in","</TITLE>","\n";
      print "</HEAD>","\n\n";
      print "<BODY>","\n\n";
#Separating the pairs and displaying them on screen.

      $n = 0;
      foreach $NameValue (@NameValuePairs)
      {
            ($Name, $Value) = split (/=/, $NameValue);
            $Value =~ tr/+/ /;
            $Value =~ s/%([\dA-Fa-f][\dA-Fa-f])/ pack ("C", hex ($1))/eg;

            print LOG "Variable=$Name, Value=$Value <BR>\n";
            print "Variable=$Name, Value=$Value <BR>\n";
            $MyVarList[$n]=$Name;
            $MyValList[$n]=$Value;
        $n++;
      }

      print "</BODY>","\n\n";
      print "</HTML>","\n\n";

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

BillyAbbottCommented:
if you want to plug them into another script then yo could write your first script like the one above, but put a form in the returned webpage.

this form should have a hidden field for each value that you want to pass onto the next script, and the submit button should call your new script.

that will pass them onto the new script.
0
sayhiAuthor Commented:
ok, i've got a good start with all your comments, BUT i only want to record what the user inputs, can u record only certain variables?
another thing is this LWP module, i looked it up and think it's for people who have there own server. how do i check if my webhosting provider has this module? or can i install this in my directory?

if i can't use this, what's the way to redirect to another URL within the cgi script?
0
sayhiAuthor Commented:
well, i figured out how to get the variables i want by doing @userinput = @formdata{'input1', 'input2'};

i think i'll do a little more reading and see what i can do ;)
0
sayhiAuthor Commented:
ok this is what i've came up:

#!/usr/bin/perl

require "subparseform.lib";
&Parse_Form;

print "Content-type: text/html\n\n";

@userinput = @formdata{'input1', 'input9'};

$input1 = @formdata{'input1'};
$input9 = @formdata{'input9'};

open (LOG, ">>log.txt");
print LOG "@userinput\n";
close(LOG);

#go to 2nd cgi
print <<"REDIRECT";
      <HTML>
      <HEAD>
      <TITLE>
      </TITLE>
      <META HTTP-EQUIV="refresh" CONTENT="0; URL=https://some.domain.com/cgi-bin/welcome.pl?&field1=$input1&field2=....&field9=$input9&field10=">
      </HEAD>
      </BODY>
      </HTML>

REDIRECT


And it works!

still, i've got one more question... how could i do this with the post type method? i know it might have to do something with STDIN.
0
ianBCommented:
Hi,

i am splitting the points on this question, per the users request, the points will be broke like this :

ozo > 65
Motaz > 50
zxr250 > 65
BillyAbbott > 20

Each expert will find their questions posted in this area.

Ian
Community Support @ Experts Exchange
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.