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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Input objects

Status
Not open for further replies.

brent123

MIS
Mar 21, 2006
29
0
0
US
Is the input tag the only way to get info from a user on a web form? I'm trying to get info from a user on a web form using a drop down box, but I can't seems to do anything with the info they select. When the user submits the form I would like to be able to store the information into a C# variable. I keep getting compile errors saying "CS0103: The name 'comments' does not exist in the current context" where comments is the name of the drop down list. Any thoughts?
 
It seems to me that something like this should work:

Code:
[tt]<select name="coments">
<option value="test">test one</option>
<option value="test2">test two</option>
</select>[/tt]



I hope this helps;
Rob Hercules
 
And make sure your select element is inside a form element, since only those inside the form will be passed. Add [tt]method="get"[/tt] in the form for an easy debug process -- this will show all the variables and values passed in the address bar.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top