我是php的新手。我正在尝试在php中发送一个html注册页面并希望它,在另一个handler.php.But响应,当我舔提交按钮时它没有移动或刷新
**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;
?>
答案 0 :(得分:6)
更改此行
<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>