以HTML提交表单时,如何指定将表单数据发送到何处?
使用动作属性将文件添加到您要在单击“提交” 按钮之后到达的位置。您还可以添加电子邮件以将数据发送到该电子邮件ID。
示例
您可以尝试运行以下代码来设置以HTML提交表单时将表单数据发送到的位置-
<!DOCTYPE html>
<html>
<body>
<h2>Student Contact Form</h2>
<form action = "mailto:emailid@example.com" method = "post" enctype = "text/plain">
Student Name:<br><input type = "text" name = "sname"> <br>
Student Subject:<br><input type = "text" name = "ssubject"><br>
<input type = "submit" value = "Send">
</form>
</body>
</html>