Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php I';我没有从使用$\u POST动态创建的字段中获取数据,知道为什么吗?_Php_Html - Fatal编程技术网

Php I';我没有从使用$\u POST动态创建的字段中获取数据,知道为什么吗?

Php I';我没有从使用$\u POST动态创建的字段中获取数据,知道为什么吗?,php,html,Php,Html,我没有从动态创建的输入字段中获取数据,即使我遵循了指示。。。提交按钮是一种图像类型。。。以下是表格 <td class="textSmall" valign="top"> New Video Image File: <input type="text" name="products_video_xl[]"> <br> Video Image Caption: <

我没有从动态创建的输入字段中获取数据,即使我遵循了指示。。。提交按钮是一种图像类型。。。以下是表格

       <td class="textSmall" valign="top">
        New Video Image File:
        <input type="text" name="products_video_xl[]">
        <br>
        Video Image Caption:
        <input type="text" name="products_video_xl_caption[]">
        </td>
  </tr>
<tr>
<td>
    <input type="image" border="0" title=" Preview " alt="Preview" src="includes/languages/english/images/buttons/button_update.gif">
    <a href="/shop/admin/editprdt.php?cPath=292&pID=6362">
    <img border="0" title=" Cancel " alt="Cancel" src="includes/languages/english/images/buttons/button_cancel.gif">
    </a> </form>
    </td> </tr>
</table>

新视频图像文件:

视频图像标题:
我认为您认为您正在提交表单,但实际上用户只需单击一个链接即可到达另一个页面。除非单击按钮提交表单,否则将不会生成$u POST数组,因此用户登录的页面肯定不会显示该数组以供检查

你可以把它改成

<input type="submit" src="your_image.png" ...>


<>但是这将是一个以图像为背景的提交按钮,而不是一个恰好出现在窗体中间的链接。 将表单与表一起使用是个好主意,您必须在表外打开和关闭表单

<form>
  <table>
     .........table content form fields
  </table>
</form>

……表格内容表单字段
  • 您在表外有打开的表单,但在表内有关闭的表单 表(这不是良好的做法,可能会导致问题)
  • 你的隐藏字段在外部,将它们放在内部
以下是正确的html格式:

已更新

<form method="post" action="shop/admin/editprdt.php?cPath=292&pID=6362&f=images&action=update_image" name="update_image">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tbody>
            <tr>
                <td class="textSmall" valign="top">
                    <input type="hidden" name="products_previous_video_xl[]">
                    <input type="hidden" name="products_previous_video_xl_caption[]">
                    New Video Image File:
                    <input type="text" name="products_video_xl[]">
                    <br>Video Image Caption:
                    <input type="text" name="products_video_xl_caption[]">
                </td>
                <td class="textSmall" valign="top">
                    New Video Image File:
                    <input type="text" name="products_video_xl[]">
                    <br>Video Image Caption:
                    <input type="text" name="products_video_xl_caption[]">
                </td>
            </tr>
            <tr>
                <td>
                    <input type="image" border="0" title=" Preview " alt="Preview" src="includes/languages/english/images/buttons/button_update.gif">
                    src="includes/languages/english/images/buttons/button_cancel.gif">
                    </a>

                </td>
            </tr>
    </table>
</form>

新视频图像文件:

视频图像标题: 新视频图像文件:
视频图像标题: src=“includes/languages/english/images/buttons/button\u cancel.gif”>
我也遇到过类似的情况,我的解决方案非常有效。以下是帮助我解决所有问题的SO帖子的链接。你必须调整以适应你的需要,但你会看到它工作得很好


为什么我得到的是其他的$POST数据,而不是动态生成的数据?不,他在最后一个元素中间关闭了表单。虽然这可能会导致问题-缺少关闭表单标记可能会阻止表单提交。哪些字段是静态的,哪些是动态生成的???您没有提到?数组字段是动态生成的。。带有数组的一个,比如说,我正在单击提交图像,但它没有显示动态生成的数据…我正在获取另一个$\u POST数据,但我认为你不应该使用数组作为元素的名称。如果要提交数组中的多个元素,则应使用相同的名称命名多个输入元素。Php将把它们放入$\u POST数组中的数组中,就像复选框一样,每个元素都共享相同的名称-因此作为具有该共享名称的数组提交。目前$\u POST数组包含什么?必须使用数组作为动态生成字段的元素名称。。我在过去做过很多次。