For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > HTML Form question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HTML Form question
Robert Hicks

2006-10-18, 6:57 pm

I have this as an option field:

<option value="5">Business Objects Support</option>

Is the "value" what gets passed back? In this case "5"?

Robert
Paul Lalli

2006-10-18, 6:57 pm

Robert Hicks wrote:
> I have this as an option field:
>
> <option value="5">Business Objects Support</option>
>
> Is the "value" what gets passed back? In this case "5"?


I have no idea what you think this question has to do with Perl. This
is purely an HTML question. Regardless, yes, the 'value' is the value
the <select> input will have when the form is submitted

<select name="foo">
<option value="alpha">one</option>
<option value="beta">two</option>
<option value="gamma">three</option>
</select>

When this form is displayed on a browser, there will be a drop down box
with three options: one, two, and three. If the user selects "two"
and submits the form, the form variable "foo" will have a value of
"beta".

Paul Lalli

Omega -1911

2006-10-18, 6:57 pm

On 10/18/06, Robert Hicks <sigzero@gmail.com> wrote:
> I have this as an option field:
>
> <option value="5">Business Objects Support</option>
>
> Is the "value" what gets passed back? In this case "5"?
>


The associated *name* and *value* are passed on to the Perl script if
you are pointing your form to a Perl script. For example, you have a
drop down list of 10 options like your above example, and the name of
the NAME of the form was BUSINESS TYPE then your Perl script would
read the form data as such:

$FORM{BUSINESS TYPE} = 5;
Robert Hicks

2006-10-18, 6:57 pm

Omega -1911 wrote:
> On 10/18/06, Robert Hicks <sigzero@gmail.com> wrote:
>
> The associated *name* and *value* are passed on to the Perl script if
> you are pointing your form to a Perl script. For example, you have a
> drop down list of 10 options like your above example, and the name of
> the NAME of the form was BUSINESS TYPE then your Perl script would
> read the form data as such:
>
> $FORM{BUSINESS TYPE} = 5;


Thanks!

Robert
Randal L. Schwartz

2006-10-20, 7:57 am

>>>>> ""Omega" == "Omega -1911" <1911que@gmail.com> writes:

"Omega> On 10/18/06, Robert Hicks <sigzero@gmail.com> wrote:[color=darkred]

"Omega> The associated *name* and *value* are passed on to the Perl script if
"Omega> you are pointing your form to a Perl script. For example, you have a
"Omega> drop down list of 10 options like your above example, and the name of
"Omega> the NAME of the form was BUSINESS TYPE then your Perl script would
"Omega> read the form data as such:

"Omega> $FORM{BUSINESS TYPE} = 5;

Only if you're using ancient perl4-style CGI modules. The modern CGI.pm
decodes this using the "param" function:

my $value = param('BUSINESS TYPE'); # returns "5"

Please don't answer other CGI questions until you've come up to at
least the mid-90's. Thank you.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com