0

I've created an account just so I could ask this question: Why is the post method not working on these simples files?

Code on file 1:

<form method="POST" action="caralho.php">
        <input type="text" id="titulo_cardapio" />
        <input type="submit" />
</form>

file 2, "caralho.php":

<?php
$crlh = $_POST['titulo_cardapio'];
echo $crlh;
?>

This simple form somehow does not post the variables, when I load "caralho.php", after clicking the submit button, this happens:

Notice: Undefined index: titulo_cardapio in C:\xampp\htdocs\cardapio\caralho.php on line 2

HOW is this happening? This is driving me insane

1 Answers1

5

Your input needs the name attribute:

<input type="text" id="titulo_cardapio" name="titulo_cardapio" />

I hope this will help you.

Ismail RBOUH
  • 10,292
  • 2
  • 24
  • 36