我目前有一个非常基本的HTML表单,它使用PHP页面将数据提交到一个简单的数据库。
我想知道是否可以将所有提交的数据放在表单下面,然后才能将其发送到数据库,以便用户确认它是正确的。 还想知道用户是否可以同时从同一页面提交多个表单?
感谢任何帮助!
答案 0 :(得分:0)
我不知道我是否理解它,但你可能会使用javascript完成一些事情。您创建了一个按下提交按钮时将触发的功能。此提交按钮必须是正常按钮才能执行此操作。然后使用onclick事件来触发该功能。这样的事情。
<form id="FormId" action="Page.php" method="POST"><!--you can use any method you want here, I used POST-->
<!--Here are some input fields-->
<input type="Button" id="Submit" value="Submit" onclick="MyFunction()"/>
</form>
在你的javascript(单独的文件或文件head标签内)中,你放了这个函数:
function MyFunction(){
var data1 = document.getElementById('inputID').value;
var data2 = document.getElementById('2einputID').value;
//You place the data where you want it, like this:
document.getElementById('IDDestination').value = data1;
//You could submit the file like this:
document.getElementById('FormId').submit();
//You could make a confirm popup to make sure all is OK:
var proceed = confirm("Submit Data? Data1="+data1+" and Data2="+data2);
if(proceed){
document.getElementById('FormId').submit();
}
}
我希望这有帮助。