|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi everyone,
Thanks to anyone who can help me out. I'm completely new to Perl and I want to do something which I am sure is extremly simple. All I want to do is read the value of a form element from page 1 into a variable into page 2. $MyVariable = What the hell goes here!?!? Thanks to anyone who responds. Judder. |
|
#2
|
|||
|
|||
|
You must read data submitted by form like this:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> # Get the form variables if ($ENV{'REQUEST_METHOD'} eq 'GET') { $buffer = $ENV{'QUERY_STRING'}; } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } # Break em up into a format the script can read @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<!--(.|n)*-->//g; $value =~ s/<([^>]|n)*>//g; $FORM{$name} = $value; } [/code] This reads forms submitted by GET or POST method. If you had text field in form named "email" you will get variable in Perl $FORM{'email'} which contains submitted data, and so on for every form element. i.e. print "Email: $FORM{'email'}"; |
|
#3
|
|||
|
|||
|
thats great, thanks!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > New & Stuck! - Requesting value from form element |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|