我们的HTML表单:
<form method="POST" class="text-center m-topp" action="play.php">
<div class="form-group d-inline-flex">
<input class="form-control" name="content" id="content" type="search" placeholder="Search something...">
<button class="btn btn-s" type="submit" id="searchBtn">Search</button>
</div>
我们的play.php页面:
<?php
$search = $_POST['content'];
echo $search;
?>
不输出任何内容。
我还考虑过以某种方式获取用户输入并仅在action="play.php?input="
中进行打印,但我希望有更多建议。
这不是敏感数据,也可以通过客户端进行传输。
您可以尝试if (isset($_POST['searchBtn'])){ echo "hello"; }
。