addarticle.html.php动态创建网页使用PHP通过URL传递变量
<?php foreach ($articles as $article): ?>
<li>
<form action="" method="post">
<div>
<a href="?viewarticle?id=<?php echo'$id' ?>">
<?php echo htmlout($article['id']);?>
<?php echo htmlout($article['summary']);?>
</a>
</div>
</form>
</li>
<?php endforeach; ?>
的index.php
if(isset($_GET['viewarticle']))
{
include_once $_SERVER['DOCUMENT_ROOT'] . '/ArticleManager/Includes/db.inc.php';
$id = mysqli_real_escape_string($link, $_POST['id']);
// Get articles belonging to author
$sql = "SELECT summary FROM articles WHERE id='$id'";
$result = mysqli_query($link, $sql);
if (!result)
{
$error = 'Error getting full article.';
include 'error.html.php';
exit();
}
include 'fullarticle.html.php';
exit();
}
fullarticle.html.php
<form action="" method="post">
<?php foreach ($articles as $article): ?>
<div>
<?php echo htmlout($article[$id]['id']);?>
<?php echo htmlout($article[$id]['summary']);?>
</div>
</form>
以下是一篇文章应用程序有一个用户点击特定的标题(来自addarticle.html.php),并动态地创建一个新的页面与完整的艺术icle被显示出来读取。我无法将上述页面的变量传递给fullarticle.html.php页面。如何正确获取应用程序后
<a href="?viewarticle?id=<?php echo'$id' ?>">
动态创建加载从数据库中特定物品信息的新页面的任何想法被点击?
我格式化了你的答案。在这里找到[Markdown help](http://stackoverflow.com/editing-help)为将来,其相当简单。 – stema 2012-03-07 14:05:58