0

so i am new to php and i was wondering what im doing wrong or what i dont really understand.

I have made a form with method post like so

  <form method="post">
   <table>
        <tr>
            <td>Vorname</td>
            <td><input type="text" name="vorname"></td>
        </tr>
        <tr>
            <td>Nachname</td>
            <td><input type="text" name="nachname"></td>
        </tr>
        <tr>
            <td>PLZ</td>
            <td><input type="number" name="plz"></td>
        </tr>
    </table>
    <button type="submit" name="send">Send</button>
</form>

In my index.phtml.

When i try to do something simple like so

   <?php
      if (isset($_POST['send'])) {
          echo "Send is Pressed!";
       }
    ?>

It does not work, and i feel like i am missing some simple step which i just don't understand.

My expectation is when i press send that the text "Send is Pressed!" appears...which it does not.

Not even dumping var_dump($_POST) the Post method, is working...

So i must be missing something..

EDIT, :

    <!DOCTYPE html>
<html>
<head>

</head>
<body>


<form method="post" action="index.phtml">
   <table>
        <tr>
            <td>Vorname</td>
            <td><input type="text" name="vorname"></td>
        </tr>
        <tr>
            <td>Nachname</td>
            <td><input type="text" name="nachname"></td>
        </tr>
        <tr>
            <td>PLZ</td>
            <td><input type="number" name="plz"></td>
        </tr>
    </table>
    <button type="submit" name="send">Send</button>
</form>

<?php
   if (isset($_POST['send'])) {
       echo "asd";
   }

   var_dump($_POST)
?>
</body>
</html>
masseyb
  • 3,745
  • 1
  • 17
  • 29
roibubble
  • 125
  • 3
  • 8

0 Answers0