代码的目标是将参数插入表单然后提交表单,然后将表单数据输入MySQL数据库.问题是该方法不发布数据.我不确定我做错了什么,我已经看了很多这方面的问题,但似乎没什么用.
这是表格.
<form action="http://localhost/Documents/dataadded.php" method="post">
<b>Add a New Data</b>
<p>Email Address:
<input type="text" name="email_address" size="30" value="" />
</p>
<p>Email Pass:
<input type="text" name="email_pass" size="30" value="" />
</p>
<p>
<input type="submit" name="submit" value="Send" />
</p>
</form>
Run Code Online (Sandbox Code Playgroud)
这是Java代码.
public static void main(String[] args) {
String key1 = "email_address";
String key2 = "email_pass";
String key3 = "submit";
String param1 = "testemail@gmail.com";
String param2 = "password123";
String param3 = "Send";
try {
URL website = new URL("http://localhost/Documents/added.php");
Map<String,String> arguments = new LinkedHashMap<>();
arguments.put(key1, param1); …Run Code Online (Sandbox Code Playgroud)