HTML / PHP表单:只有一些名称有效

时间:2016-05-17 14:18:19

标签: php html post

我在这里有这个html表单:

<form action = "<?php $_PHP_SELF ?>" id="addTip" method = "POST">
            Título: <input type = "text" name = "title" />
            Tipo:   <input type = "text" name = "type"  />
            Data:   <input type = "text" name = "data"  />
            Imagem: <input type = "text" name = "image" />
                    <input type = "submit"              />
        </form>

        <textarea name="comment" form="addTip">Enter text here...</textarea>

我在这样的php文件上调用它:

if($_REQUEST["title"] || $_REQUEST["type"] || $_REQUEST["data"] || $_REQUEST["image"]){...}

html代码位于php之下,因此上面的代码都是1页。

当我打开文件时,REQUEST会返回一个错误,指出每个<input>都有未定义的索引,但type和image除外。

如果我更改了图片和类型的名称,那些<input>也无法正常工作。

如果我再次将名称更改为图像并键入代码可以工作,如果我只将它们用作$_REQUEST,那么我的php代码效果很好。

为什么我有这种行为?

0 个答案:

没有答案