<form action="vote.jsp" method="post"> <input type="radio" name="vote" value="option1">Option 1<br> <input type="radio" name="vote" value="option2">Option 2<br> <input type="submit" value="Submit"> </form>与数据库vote连接
时间: 2023-07-19 10:47:21 浏览: 43
这段代码是一个表单,其中包含两个单选框和一个提交按钮。当用户选择一个选项并点击提交按钮时,表单数据将被发送到 "vote.jsp" 页面。在 "vote.jsp" 页面中,可以使用服务器端代码来连接数据库并将用户投票存储到数据库中。这可以使用 Java 中的 JDBC 或其他服务器端技术来实现。具体实现方式取决于所选的服务器端技术和数据库类型。
相关问题
<form action="bank.php" method="POST">
I'm sorry, as an AI language model, I am unable to display the full code for a PHP form. However, here is an example of a basic PHP form:
```
<!DOCTYPE html>
<html>
<head>
<title>Bank Form</title>
</head>
<body>
<form action="bank.php" method="POST">
<label for="name">Name:</label>
<input type="text" name="name" id="name"><br>
<label for="account">Account Number:</label>
<input type="text" name="account" id="account"><br>
<label for="amount">Amount:</label>
<input type="text" name="amount" id="amount"><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
```
This form has three input fields for the user to fill out: their name, account number, and the amount they want to deposit or withdraw. Once the user clicks the submit button, the form data will be sent to a PHP script named "bank.php". From there, the script can process the data and respond accordingly.
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <a href=one.jsp>one.jsp</a> <a href=two.jsp>two.jsp</a> <a href=three.jsp>three.jsp</a> <a href=error.jsp>error.jsp</a> </head> <body> 请输入1至100之间的整数:<input type="text" name="name"> <input type="submit" value=提交> <% String str=request.getParameter("name"); if(1<=str<=50){ %> <form action="two.jsp" method=post/> <% } else if(50<str<=100){ %> <form action="three.jsp"method=post/> <% } else{ %> <form action="error.jsp"method=post/> <% } %> </body> </html>
这段代码是一个简单的JSP页面,包含了一个表单,用户输入一个1至100之间的整数,点击提交按钮,会根据输入的整数跳转到不同的页面。具体实现是通过获取表单中名为"name"的参数值,判断其大小范围,根据不同的范围跳转到相应的JSP页面。其中,使用了Java语言中的if-else条件语句和JSP标签。页面中包含了4个超链接,分别跳转到不同的JSP页面。