Form does not send data [duplicate]

0

I'm trying to make the data entered by the user appear on another page when he clicks the button, but the page is updated but does not contain the information entered.

HTML file

 <form action="php/dados.php" method="post">

        <input type="text" id="cNome" name="tNome" size="20" maxlength="20" placeholder="       Digite Seu Nome"/>
     <input type="submit" value="Enviar"/>
    <input type="reset" value="Cancelar"/>
  </form>

PHP file

<?php

    $nome = $_POST["tNome"];
    echo "Obrigado $nome";
?>

I have looked several times but can not find the error, what would it be?

    
asked by anonymous 25.01.2017 / 16:16

1 answer

2

You should be using either file:/// protocol instead of http:// (for example you accessed file:///c:/Users/Lone/Documents/projeto/form.php instead of http://localhost/form.php ) or you should be using Apache without PHP.

As I explained here link , if it is Windows install or Xampp or Wamp or easyphp

If you have already installed it, you may be accessing something like this with the browser file:///c:/wamp/www/form.php , see the URL in the similar browser with this:

Thiswillnotwork,theprotocolfileisforrunninglocalfiles,Apacheisaserver,eveniflocalandyouneedtorunthroughit.

AfterinstallingXampp,Lamp(linux),Wamp,Mamp(MacOSX),youshouldcopyyourfilestothefollowing"possible" folders (these folders are for example, but the path should look like this):

  • Windows and Wamp: c:/wamp/www
  • Windows and Xampp: c:/xampp/htdocs
  • Linux and Lamp / Xampp: /otp/lamp/htdocs
  • Linux installed via repository: /var/www

Of course you can point to other folders, but that's another story.

    
25.01.2017 / 16:25