Advertisements
I am wokring on a small project to learn more about the request methods on PHP. In which I take the value from a 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 checkedvar_dump($_POST),but also return nothing. what i did wrong?
I did a check on the _POST array but i coudnt find the value
>Solution :
You form request is going through GET method and not POST. Change your form method from this method="GET" to this method="POST".