| |

VerySource

 Forgot password?
 Register
Search
View: 877|Reply: 5

How can I get the value in the select

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-25 14:20:01
| Show all posts |Read mode
How can I get the value in select, which is the value of option value, I want to use the value of option as the 'obtained value' in database query
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-14 08:30:02
| Show all posts
request.getParameter ("yourTagName");
Reply

Use magic Report

2

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Invalid IP Address

Post time: 2020-2-18 16:15:01
| Show all posts
Modify the name of the selection, for example, its name attribute becomes "name =" myTag "", and then write String tag = request.getParameter ("myTag") in the program;
Note that the two myTags must be the same
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Invalid IP Address

Post time: 2020-3-4 11:30:01
| Show all posts
Variable = request.getParameter ("yourTagName");
select * from table where field like 'variable'
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Invalid IP Address

Post time: 2020-4-11 20:30:01
| Show all posts
<Script language = "javascript">

function query () {
alert (form1.select.options [form1.select.selectedIndex] .text);
   if (form1.select.options [form1.select.selectedIndex] .text == "computer") {
      return form1.select.options [form1.select.selectedIndex] .text;
  } else if (form1.select.options [form1.select.selectedIndex] .text == "Mechanical Department") {
   return form1.select.options [form1.select.selectedIndex] .text;
   } else if (form1.select.options [form1.select.selectedIndex] .text == "Electronic Department") {
   return form1.select.options [form1.select.selectedIndex] .text;
   } else if (form1.select.options [form1.select.selectedIndex] .text == "Department of Mathematics") {
   return form1.select.options [form1.select.selectedIndex] .text;
   }
}

</ script>
<form name = "form1">
<select name = "select">
<option value = "0"> Please select </ option>
<option> Mechanical Department </ option>
<option> Electronic Department </ option>
<option> Department of Mathematics </ option>
<option> Computer </ option>
</ select>
<input type = "button" value = "OK" onclick = "query ()">
</ form>
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-16 20:30:02
| Show all posts
select has value attribute
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list