英文:
the return from the form doest appeare in the backend side of my code
问题
当我点击提交时,没有任何反应。我检查了 var_dump($_POST)
但仍然没有返回任何内容。我还尝试了将整个 $_POST
数组输出,但是没有值被打印出来。
英文:
I am working on a small project to learn more about HTTP request methods using PHP. As a simple example, I want to take the value from user input and do text transformation on it, then return it to the user.
html
<form action="index.php" method="GET">
<input type="text" placeholder="Enter name" name="name"/>
<input type="submit" value="Go" name="submit"/>
</form>
php
<?php
if(isset($_POST["submit"])) {
$name = $_POST["name"];
$result = strtoupper($name);
echo $result;
}
?>
When I click on submit, nothing happens. I checked var_dump($_POST)
but it still returns nothing. What am I missing?
I also did a check on dumping the entire $_POST
array but no value is printed out.
答案1
得分: -1
你的表单请求是通过 GET 方法进行的,而不是 POST。请将你的表单方法从 method="GET" 更改为 method="POST"。
英文:
You form request is going through GET method and not POST. Change your form method from this method="GET" to this method="POST".
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论