simple POST method not working

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:xampphtdocscardapiocaralho.php on line 2

HOW is this happening? This is driving me insane


Your input needs the name attribute:

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

I hope this will help you.

链接地址: http://www.djcxy.com/p/88054.html

上一篇: 使用jQuery进行单选按钮验证

下一篇: 简单的POST方法不起作用