Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.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增量,而不是发布的URL_Php_Html_Foreach - Fatal编程技术网

每个按钮标签上的PHP增量,而不是发布的URL

每个按钮标签上的PHP增量,而不是发布的URL,php,html,foreach,Php,Html,Foreach,我正在创建一个网页,从网站内的目录中读取和显示文件,我使用for-each循环遍历文件,并根据增量给出特定名称。当用户单击特定按钮时,我不希望我的表单传递特定的增量,这样我就知道在进入下一页时使用哪个文件。按钮按预期显示增量,但url总是将“1”作为值传递,我真的不知道为什么,我附加了一张图片显示按钮工作,但链接总是变为 元素的ID必须是唯一的。当前,对于中的每个迭代,您都为“modal div”提供相同的ID <div class='modal fade' id='exampleModa

我正在创建一个网页,从网站内的目录中读取和显示文件,我使用for-each循环遍历文件,并根据增量给出特定名称。当用户单击特定按钮时,我不希望我的表单传递特定的增量,这样我就知道在进入下一页时使用哪个文件。按钮按预期显示增量,但url总是将“1”作为值传递,我真的不知道为什么,我附加了一张图片显示按钮工作,但链接总是变为


元素的ID必须是唯一的。当前,对于中的每个迭代,您都为“modal div”提供相同的ID

<div class='modal fade' id='exampleModalCenter' tabindex='-1' 
role='dialog' aria-labelledby='exampleModalCenterTitle' aria-hidden='true'>

那么,如果somone在显示第一个页面和尝试在第二个脚本中获取正确的文件之间的文件夹中创建另一个文件,会发生什么呢?不,对不起,解释得不好。文件已经在文件夹中,当用户单击“引用”时,它会将文件带到另一个显示内容的网页。我正在尝试在url中传递id(即,incincrint),这样我就可以在目录中循环并选择所选id处的文件。但是url中的增量始终为“1”,但是按钮能够正确显示增量(我将此作为一个测试)嗨,我说这不是一个很好的主意。唯一可以保证不会更改的是文件名我只是想在url中传递增量,但它不起作用,我不知道为什么。我知道这可能不是最好的方法,但我想不出更好的方法。我在我的网页上做了这件事,但没有链接到这个网页。我真不敢相信我竟然没想到在这里这么做。非常感谢,这起作用了。如果我有足够的代表点数来支持你的回答,我会的,但是,唉,我没有。谢谢,这对我有用!很高兴我能帮忙!你已经快到了,只是错过了这一点。
<div class='modal fade' id='exampleModalCenter' tabindex='-1' 
role='dialog' aria-labelledby='exampleModalCenterTitle' aria-hidden='true'>
<button type="button" data-toggle="modal" data-target="#exampleModal<?php echo $zed; ?>">
your button
</button>

<div class="modal" id="exampleModal<?php echo $zed; ?>">
your modal
</div>