running php problem

Asked

Viewed 21 times

-1

Hello, I have the following problem:

I created an input and the values that are typed in it, when pressing a button should be sent to an array in my ". php".

The problem is that in addition to not being capturing the values, when I press the button it simply redirects me to the file ". php" and shows on the screen all the code that is inside it.

If anyone can help me I’d appreciate it.

My HTML:

    <!DOCTYPE html>
    <html>
    <head>
        <title>Menu</title>
        <link rel="stylesheet" type="text/css" href="stile.css">
    </head>
    <body>
    <div id="conteudo">
        <div id="adicionarItens">
                <h4>Dados</h4>
                <form action="sistema.php" method="post">
                    <p>
                        <input type="text" name="dados" value="" />
                    </p>
                    <p>
                        <input type="submit" id="botaoE" value="submit me!" />
                    </p>
                </form> 
            </div>
        </div>
    </body>
    </html>

and PHP:

    <?php  

        if(isset($_POST["dados"]))
        {
            $valor = $_POST["dados"];

            echo $valor;
        }
    ?>

Thanks in advance.

  • This must happen because you are not using an HTTP server with PHP language support. You will need Apache, Nginx or similar for this. Are using any of these?

  • That was really the problem, I had forgotten that to be able to use the php language would need to be with Apache active. Thank you.

1 answer

-1

Browser other questions tagged

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