Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pleas help. If I want to show user

Status
Not open for further replies.

yj7sum

Programmer
Jul 24, 2001
6
0
0
US
Pleas help. If I want to show user's input in the text box, then it's "if (!(defined $input->{''})). However, if I want to show that a user picks one of the options in the radio button, either "look up" or "add to database", what kind of syntax should I use?

I use $input {"info"} to refer to each of the radio button. How do I refer to one specific ratio button, let say if look up is picked, then do something after that?

<form METHOD=&quot;POST&quot; ACTION=&quot;/cgi-bin/name.pl&quot;>

Account Number: <INPUT TYPE=&quot;text&quot; SIZE=25 NAME=&quot;accountnum&quot;>

Look up: <INPUT TYPE=&quot;radio&quot; NAME=&quot;info&quot; VALUE=&quot;lookup&quot; CHECKED>

Add to database: <INPUT TYPE=&quot;radio&quot; NAME=&quot;info&quot; VALUE=&quot;addb&quot;>

Thank you in advance.

 
If each of your radio buttons has a different value, then the value for that form element will have the value of the selected radio button. For example:
Code:
if ( $input{&quot;info&quot;} eq &quot;lookup&quot; ) {
   # do lookup here
} elsif ( $input{&quot;info&quot;} eq &quot;addb&quot; ) {
   # do add here
} else {
   # no button selected
}
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top