Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 143
  • Last Modified:

tranfering information from and javascript order form to a cgi script

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
rcplan2u
Asked:
rcplan2u
  • 3
  • 2
1 Solution
 
ahoffmannCommented:
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
 
rcplan2uAuthor Commented:
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
 
ahoffmannCommented:
which language?
 ada, C, fortran, modula, pascal, perl, ruby, shell, ...
just to mention a few ;-)
0
 
rcplan2uAuthor Commented:
I am sorry, perl would be the language.
Thank you
0
 
ahoffmannCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now