Car Shop

Carashope

Archive for the ‘abstract’ tag

Value Pkg

without comments

How to pass parameters from java script to Perl?

Javascript submits a form that prompts the user to enter data. In the form part, I am trying to call a perl script that should take the parameter values entered; document.form1.compName.value and document.form1.compPackage.value:

My Perl script gets called successfully but the parameters are not passed. I use
use Getopt::Std;
GetOptions( "comp=s",
"pkg=s",
);

getopts("f:");
if ($opt_comp) {
$comp = $opt_comp;
}
if ($opt_pkg) {
$package = $opt_pkg;
}

The perl script works fine from a command line:
myperl.pl -comp 'compname' -pkg 'pkgname'

any help?

Command line and CGI (Common Gateway Interface) are two separate things. You'll need to access your form parameters through the query string, which'll look like ?compName=xxx&compPackage=yyy. The thing you're trying to do in your form tag is invalid -- there can be no attribute-less values in XHTML/HTML. See second source for more information on forms.

$cgi_form = new CGI::Form;
$comp = $cgi_form->param('compName');
$pkg = $cgi_form->param('compPackage');

Have not tried this myself. You'll need to install and/or use the CGI stuff. See first source for more CGI-related information.

powered by Yahoo! answers

Lexus RX AWD 4dr 2009 LEXUS RX350 AWDMATADOR REDLUXURY VALUE PKGONLY 25000 MILESBRAND NEW
Lexus RX AWD 4dr 2009 LEXUS RX350 AWDMATADOR REDLUXURY VALUE PKGONLY 25000 MILESBRAND NEW
Paypal   US $27,450.00
BMW 3 Series 328xi 10 BMW 328xi GRAY AUTO WARRANTY PREMIUM VALUE PKG MOONROOF STATION WAGON
BMW 3 Series 328xi 10 BMW 328xi GRAY AUTO WARRANTY PREMIUM VALUE PKG MOONROOF STATION WAGON
   US $1,000.00
Subaru Forester 2011 Subaru Forester 4dr Auto 25X w Alloy Wheel Value Pkg
Subaru Forester 2011 Subaru Forester 4dr Auto 25X w Alloy Wheel Value Pkg
   US $18,999.00
Audi A3 20 TDI Prem 20 TDI S TRONIC BLUETOOTH VALUE PKG REAR SIDE AIRBAGS SAT WRNTY 42 MPG
Audi A3 20 TDI Prem 20 TDI S TRONIC BLUETOOTH VALUE PKG REAR SIDE AIRBAGS SAT WRNTY 42 MPG
   US $27,500.00
BMW 135 135I 11 BMW CONVERTIBLE PREMIUM PKG SPORT PKG VALUE PKG NAVIGATION XENON 24K MILES
BMW 135 135I 11 BMW CONVERTIBLE PREMIUM PKG SPORT PKG VALUE PKG NAVIGATION XENON 24K MILES
   US $35,698.00
BMW 535 I XDRIVE 10 BMW 535I X DRIVE NAVIGATION SPORT PKG COMFORT ACCESS VALUE PKG
BMW 535 I XDRIVE 10 BMW 535I X DRIVE NAVIGATION SPORT PKG COMFORT ACCESS VALUE PKG
   US $37,477.00
BMW 3 Series NAVIGATION NAVIGATION VALUE PKG PREMIUM PKG
BMW 3 Series NAVIGATION NAVIGATION VALUE PKG PREMIUM PKG
Paypal   US $30,694.00
BMW 1 Series 135i Convert 1 OWNER 135i CONVERTIBLE M SPORT PKG 7 SPEED DOUBLE CLUTCH VALUE PKG HTD SEATS
BMW 1 Series 135i Convert 1 OWNER 135i CONVERTIBLE M SPORT PKG 7 SPEED DOUBLE CLUTCH VALUE PKG HTD SEATS
   US $15,000.00
BMW 328 I 2011 BMW 328i Sedan ACTIVE CPO AUTO PREMIUM VALUE PKG CLEAN LOW MILES
BMW 328 I 2011 BMW 328i Sedan ACTIVE CPO AUTO PREMIUM VALUE PKG CLEAN LOW MILES
   US $28,992.00

Written by admin

March 5th, 2010 at 12:59 am

Posted in car-mg

Tagged with , , , ,