注意:两个submit的name要相同
前端
index.html
<!DOCTYPE html>
<html>
<head>
<title>收录系统</title>
<meta charset="utf-8">
</head>
<body>
<h1>搜索</h1><br/>
<form action="search.php" method="post">
收录内容:<input type="text" name="keywords" placeholder=">
搜索不到?可能还没被收录哦~">
<input type="submit" name="submit" value="搜索">
<input type="submit" name="submit" value="添加">
</form>
</body>
</html>
处理过程
search.php
<?php
if($_POST){
$nval = $_POST['submit'];
if($nval=='添加'){
echo "添加";
}else{
echo "搜索";
}
}
?>