打开文章时显示文章中的文章ID(a href)

时间:2014-02-06 20:03:37

标签: php jquery sql

当我点击这个部分时,一个href =“。$ row ['id']。”我的手风琴滑开,文章是可见的,但是当我打开这部分时,我也希望文章ID显示在网址中 所以index.php?id = id等等,我是php的新手,所以我需要添加到这段代码中 让它工作?

session_start();

require_once("inc/connection.php");
mysql_select_db("nieuws");

$(document).ready(function(){
$('.acc_container').hide(); //Hide/close all containers
//On Click
$('.acc_trigger').click(function(){
if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
    $('.acc_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
    $(this).toggleClass('active').next().slideDown();
}
return false; //Prevent the browser jump to the link anchor
});
});
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
<input type="submit" name="delete" value="Verwijderen" /> <p style="font-size:12px;">selecteer een artikel</p>
$query="SELECT id,datum,titel,artikel FROM nieuws ORDER BY id DESC";
$result=mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo ("<div id=\"artikeltitel\" align=\"center\">
    <div id=\"containerdatum\">".$row['datum']."</div>
    <div id=\"containertitel\">".$row['titel']."</div>
    <div id=\"container3\" style=\"font-size:12px;\">".$row['id']."
    <input type=\"checkbox\" name=\"checkbox[]\" id=\"checkbox\"  value=\"".$row['id']."\"       />
    </div>
    </div>
    <div class=\"container\" align=\"center\">
    <h2 class=\"acc_trigger\"><a href=".$row['id']."> &#187; </a></h2>
    <div class=\"acc_container\">
    <div class=\"block\">".$row['artikel']."</div>
    <div class=\"fb-comments\" data-href=\"http://www.zpb-polonez.be/user.php\" data-num-    posts=\"10\" data-width=\"678\" style=\"margin-top:2px;\"></div>
    </div>
    </div>
    ");
}
</form>

0 个答案:

没有答案