php – Not getting data after using post method and still data in url-ThrowExceptions

Exception or error:

I have started using php and i starting working with html forms, I used method GET at first and it was working fine but when i used method POST, I cannot get data saved in variables and still url is showing data and I am using $_POST["name"] if you thinking,

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="site.php",method="post">
    Name:<input type="text" name="text" id="text">
    Password:<input type="password" name="pass" id="">
    <input type="submit" value="submit">
    </form>
    <br>
    <?php
        $name=$_POST["text"];
        $pass=$_POST["pass"];
        echo $name;
        echo $pass;
    ?>
</body>
</html>
How to solve:

Are you shure, that the new script is running -> turn OFF the cache of your browser.

Leave a Reply

Your email address will not be published. Required fields are marked *