Regarding the post in php

0

So I'm learning PHP a short time, and I'm having a doubt, in this code I can compile normally with get, but when I use the post, the code does not compile, does not show errors, code that I sent to a friend with a post type request worked on his machine, does anyone know what might have happened?

<form action="PassWord.php" name="CadastroForm" method="post">
    <label>
        <span>Senha:</span>
        <input type="password" name="senha" value="">
    </label>

    <input type="submit" value="Enviar Dados" name="send">
</form>

<?php
    var_dump($_POST['send']);
    if (isset($_POST['send'])){
        $pass = $_POST['senha'];
        $pass = base64_encode(md5($pass));

        echo $pass."<hr>";
    }



?>
    
asked by anonymous 22.10.2016 / 20:05

1 answer

0

It would be interesting if you put a print of what appears when you run the file. But since I do not know if the file name in the action exists, we can remove the action attribute, causing the browser itself to identify the file name. Also make sure you are running the file through a web server with a php interpreter. Test in PHPFiddle .

<form  name="CadastroForm" method="post">
    <label>
        <span>Senha:</span>
        <input type="password" name="senha" value="">
    </label>

    <input type="submit" value="Enviar Dados" name="send">
</form>

<?php
    var_dump($_POST['send']);
    if (isset($_POST['send'])){
        $pass = $_POST['senha'];
        $pass = base64_encode(md5($pass));

        echo $pass."<hr>";
    }



?>
    
23.10.2016 / 19:57