?
Solved

tranfering information from and javascript order form to a cgi script

Posted on 2003-03-11
5
Medium Priority
?
142 Views
Last Modified: 2013-12-25
With-in my  javascript order form i have the following input code

document.writeln('<INPUT TYPE="hidden" NAME="x_Amount " VALUE=" '+MakeTwo(totprice)+'" SIZE="40">');


 I would like to find out how I would be able to transfer the value of this
 input code once it submitted to a cgi script,  to a variable $x_Amount with in the cgi script.
0
Comment
Question by:rcplan2u
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 280 total points
ID: 8118395
if you cgi script is called with GET method, it needs to read the QUERY_STRING environment variable, if it is called with the POST method it needs to read STDIN.
Then you need to split the read result into key value pairs at the = sign, the right hand part will be assigned to $x_Amount.

That's in humam words, implementaion depends on your languge used for cgi script.
0
 

Author Comment

by:rcplan2u
ID: 8118804
I am not to sure I know what you are trying to say, my cgi script is called with a post.
Do you have any examples of the way this would be written.
Thank you
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8119112
which language?
 ada, C, fortran, modula, pascal, perl, ruby, shell, ...
just to mention a few ;-)
0
 

Author Comment

by:rcplan2u
ID: 8119180
I am sorry, perl would be the language.
Thank you
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 8119522
my ($meth) = $ENV{'REQUEST_METHOD'} if defined($ENV{'REQUEST_METHOD'});
my (buffer);
if ($meth eq 'POST') {
   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
foreach my $pair (split(/&/, $buffer)) {
   my ($name, $value) = split(/=/, $pair);
   # probably a lot of checks nedded here
   $::FORM{$name} = $value;
}
print "got= $::FORM{'x_Amount'} \n";
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question