Regarding the post in php

Asked

Viewed 27 times

0

So I’m learning PHP a little bit, and I’m having a doubt, in this code I can compile normally with get, but when I use the post, the code doesn’t compile, it doesn’t show errors, I realized a little while ago, that a code I sent to a friend with post type requisition worked on his machine, someone knows 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>";
    }



?>
  • Take that die() there.

  • 2

    PHP does not compile! It is a script language, interpreted. Hugs.

  • @taiar, thanks man, but on other pc’s the code works with post, know what is happening? and take die() did not help.

  • Is your file called Password.php in all of them? The directory is perfect?

  • you need to insert more elements of the problem, such as: Are you using pure php or some cms platform? that file Password.php is the code below the form?

1 answer

0

It would be interesting to put a print of the ue appears when you run the file. But since I don’t 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 that you are running the file through a web server with a php interpreter. Test on 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>";
    }



?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.