【发布时间】:2018-03-18 04:27:08
【问题描述】:
我需要帮助!
为什么会出现以下代码:
function buildDeleteForm($deleteUrl,$searchArray) {
print ("<form target=\"_self\" method=\"post\">\n");
print ("<input type=\"hidden\" name=\"delUrl\" value=\"" . $deleteUrl . "\" />\n");
print ("<input type=\"hidden\" name=\"url\" value=\"" . $searchArray . "\" />\n");
print ("<input type=\"submit\" name=\"delete\" value=\"delete\" />\n</form>\n");
}
foreach ($urls as $url) {
$url = preg_replace('/\s+/', '', $url);
print("<tr><td>" . $url . "</td>");
$response = sendRestRequest($url,$type);
$status = $response['http_code'];
if ($status == 200) {
// build the form
print("<td class=\"result\"><img src=\"200.png\"></td><td class=\"right\">" . buildDeleteForm($url,$urllist) . "</td></tr>");
} elseif ($status == 404) {
print("<td class=\"result\"><img src=\"404.png\"></td><td class=\"right\"> </td></tr>");
} else {
print("<td class=\"result\"><img src=\"error.png\"></td><td class=\"right\">" . $status . "</td></tr>");
}
}
制作这个疯狂的 HTML:
<tr>
<td>
http://someserver4017.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790
</td>
<form target="_self" method="post">
<input type="hidden" name="delUrl" value="http://someserver4017.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790" />
<input type="hidden" name="url" value="http://someserver4017.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790,http://someserver4018.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790,http://someserver4020.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790" />
<input type="submit" name="delete" value="delete" />
</form>
<td class="result">
<img src="200.png">
</td>
<td class="right">
</td>
</tr>
它完全脱离了表格单元格的形式......我可以理解它是否只是一个 css 东西,但这是实际生成的源代码完全奇怪。我知道这很简单,我只是看不到而且看起来很愚蠢-但是嘿,我只是想让它工作:)
【问题讨论】:
标签: php html forms html-table