PHP Grab用户输入并将其发送到下一页

问题描述 投票:0回答:1

我们的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="中进行打印,但我希望有更多建议。

这不是敏感数据,也可以通过客户端进行传输。

php input transfer
1个回答
0
投票

您可以尝试if (isset($_POST['searchBtn'])){ echo "hello"; }

© www.soinside.com 2019 - 2024. All rights reserved.