如何在提交表单后显示当前网址的文字 www.example.com/?n=Example-Text
<form method="post" action="/submit.php">
<div class="enter-name">
<input class="animated pulse infinite" type="name" required="" maxlength="50" name="n" placeholder="Enter Your Text Here">
<button class="btn" type="submit"><span>></span> Go</button>
</div>
</form>
答案 0 :(得分:1)
如果要显示输入name="n"
中的文字,
制作表单方法GET
<form method="get" action="/submit.php">
并在 submit.php
中<?php
echo $_GET['n'];
?>
答案 1 :(得分:0)
当您的代码的响应为GET
响应时,如表格标记POST
<form method="post" action="/submit.php">
请求
对于您提供的示例, submit.php 页面需要具有以下代码
<?php echo $_POST['n']; ?>
这将显示内联通过表单提交后名称=“n”输入中的值。
如果您想要查看传递给网址中 submit.php 文件的信息,则需要更改HTML以使用get
方法替代表单当前使用的post
答案 2 :(得分:-1)
<form method="post" action="/submit.php">
<div class="enter-name">
<input class="animated pulse infinite" type="name" required="" maxlength="50" name="n" placeholder="Enter Your Text Here">
<button class="btn" type="submit"><span>></span> Go</button>
</div>
</form>
你必须设置get方法而不是post, 将传递参数传递给url,称为urlencodded,
<form method="get" action="/submit.php">