Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old May 20th, 2000, 01:25 PM
ceramicarte ceramicarte is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 2 ceramicarte User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have on my html page a combobox control named "Familia". How do I read on a Perl script the selected value that combobox?

I guess it should be something like this:

$Value= $FORM{'Familia'};

but I've got and Internal Server Error.

Can somebody help me???????

Reply With Quote
  #2  
Old May 22nd, 2000, 12:48 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 9
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

<<$Value= $FORM{'Familia'};>>

For getting your value like this you should parse the form.

here i am writing an example showing how you can parse value from a form using POST Method.

#############
# Parse form

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

#read the values from envourment variable .store in buffer.

@pairs = split(/&/, $buffer);

#split that buffer value

foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);

#separate name and values from the pair.

$value =~ tr/+/ /;
#remove all the + from value..
$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;
#assain all the value to name..
}
##############

now you can get the value like this.

$Value= $FORM{'Familia'}

##############-------############-###########--

If you you can use cgi.pm module you can get the input very easily.


see this example..

test.htm

<form method="post" action="test.cgi">

<select name="Familia">

<select size="1" name="Familia">
<option selected value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>

<input type="submit" name="submit" value="submit">
</form>


test.cgi

#!/usr/perl/bin

use CGI;
#use CGI.pm module

$q=new CGI;


$value=$q->param('Familia');

#get the parameter from name field
# and store in $value variable.

print $q->header;
#print the header
print "<html>n";
print "<head><title>Test</title></head>n";
print "<body>n";

print "<h1>Testing form input</h1>n";
print "<b>Selected value is: ".$value."</b>n";

#just call the $value varable here.
print "</body>n";
print "</htm>n";

Hope this may help you to solve your problem..


Good Luck!!!!!




------------------
SR -
shiju.dreamcenter.net

"The fear of the LORD is the beginning of knowledge..."

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Passing values from HTML to a Perl script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway