我目前有一个相当基本的HTML表单,它使用PHP页面将数据提交到一个简单的数据库。
我想知道是否可以在将表单发送到数据库之前将所有提交的数据放在表单下方,以便用户确认其正确性。还想知道是否有办法让用户同时从同一页面提交多个表单?
任何帮助不胜感激!
我不知道
我是否理解它,但你可能会使用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(单独的文件或文档头标签内),你把这个函数:
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();
}
}
我希望这有所帮助。