displayCategories.html.php
<?php
session_start();
?>
<table>
<tr>
<th>Category Name</th>
<th>Description</th>
<th>Edit</th>
</tr>
<?php foreach ($_SESSION['categoryRows'] as $row):
$categoryName = $row["CategoryName"];
$description = $row["Description"];
$categoryId = $row["CategoryId"];
$url = "templates/displayCategories.html.php";
?>
<?php if (isset($_GET['id']) && ($_GET['id'] == $categoryId)):?>
<form>abc</form>
<?php else:?>
<tr>
<td><?= $categoryName ?></td>
<td><?= $description ?></td>
<td><a href="<?= $url ?>?id=<?= $categoryId ?>">Edit</a></td>
</tr>
<?php endif;?>
<?php endforeach;?>
</table>
当我单击“编辑”时,链接将来自
templates / displayCategories.html.php
到
templates / templates / displayCategories.html.php
URL中有两个模板!怎么这样?
答案 0 :(得分:0)
在链接上使用绝对URL
根据您的情况,使用/blah/blah/blah/question 1/templates/displayCategories.html.php
答案 1 :(得分:0)
这是因为您使用了相对路径原因,请尝试<a href="/<?= $url ?>?id=<?= $categoryId ?>"