|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
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
|
||||
|
||||
|
What is the simplest way to enter data into a single field, then have another page come up with it's output(ie one html page that calls a cgi script). I want it to print out the data unparsed.
|
|
#2
|
|||
|
|||
|
##form.html##
<html> <body> <form method="POST" action="/cgi-bin/script.pl"> <input type="text" name="email"><br> <input type="submit" value="submit"> </form> </body> </html> ##script.pl## #!/usr/local/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @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; } print "Content-type: text/htmlnn"; if ($FORM{'email'} eq "") { print "Blank field!n"; } else { print "$FORM{'email'}n"; } exit; |
|
#3
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by tron:
What is the simplest way to enter data into a single field, then have another page come up with it's output(ie one html page that calls a cgi script). I want it to print out the data unparsed.[/quote] Well, whatever you do, don't start reinventing the wheel. Spend the time and sweat to understand the following: http://stein.cshl.org/WWW/software/CGI/ Peter |
|
#4
|
|||
|
|||
|
this would print out the entire data being sent, unparsed.
#!/usr/local/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); print "$buffer"; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > CGI and Form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|