我是PHP新手。我正在尝试用 php 发送一个 html 注册页面并希望它在另一个处理程序中的响应.php.但是当我舔提交按钮时,它没有移动或刷新
**Registration.html**
<html >
<form action="handler.php" method="post" >
<label>First Name</label>
<input type="text" name="firstname" id="firstname" value="" /> <br/><br/>
<label >Last Name</label>
<input type="text" name="lastname" id="lastname" value=""/> <br/><br/>
<input name="Submit" type="button" value="Submit Details" />
</form>
</html>
**handler.php**
<?php
$FirstName=$_REQUEST['firstname'];
$LastName=$_REQUEST['lastname'];
echo 'welcome'.$FirstName;
?>
更改此行
<input name="Submit" type="button" value="Submit Details" />
自
<input name="Submit" type="submit" value="Submit Details" />
添加 JavaScript 函数
<input name="Submit" type="button" value="Submit Details" onclick="submitfunction();"/>
<script type="text/javascript">
function submitfunction()
{
document.getElementById("YOURFORMID").submit();
}
</script>