我正在尝试创建一个由jquery手风琴组成的界面,其中将列出年份,当有人点击它应该展开的一年时,应该有另一个类似的手风琴,它将包含该特定年份的所有发票号码。我尝试使用php打印值,而valus正确打印。
php代码
<?php
include('validateuser.php');
if(isset($_GET['customername']))
{
$flag=validate($_GET['customername'],$z);
if($flag==1)
{
$ccodeforquery=$_GET['customername'];
$cnamesql=mysql_query("select * from custcode where Cust_code='$ccodeforquery'");
if($cnamesql==FALSE)
die(mysql_error());
while($rowforcname=mysql_fetch_array($cnamesql)) {
?>
<?php echo "Purchase History of ".$rowforcname['Cust_Name']; } ?>
<?php if($count2<>0) { ?>
<a href="#pop4" class="classname">Add</a><?php } ?>
<div id="accordion">
<?php
$j=$_GET["customername"];
$_SESSION['cn']=$j;
//echo $j;
$result = mysql_query("SELECT * FROM purchase_history where Cust_code='$j' group by year(date) desc");
if($result==FALSE)
die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$dateArray = explode('-', $row['date']);
$year = current($dateArray);
//$theData[$year][] = $row;
?>
<h3><?php echo $year; ?></h3>
<div>
<p>
<?php $resultyear=mysql_query("select * from purchase_history where Cust_code='$j' and year(date)= '$year'");
if($resultyear==FALSE)
die(mysql_error());
while($rowyear=mysql_fetch_array($resultyear)) {
?>
</p>
<div class="accordian2">
<h3><a href="#"><?php echo $rowyear['invoice_no']; } ?></a></h3>
<div>
</div>
</div>
</div>
<?php } ?>
</div>
<center><?php } else { ?>
<img src="/images/Access-Denied.jpeg" width="200" height="200" />
<?php } } ?></center>
我附上了输出的屏幕截图。 不使用嵌套的手风琴,输出就像 https://www.dropbox.com/s/w7fhcd4s127sl1r/capture1.png https://www.dropbox.com/s/r29j9df9riiwwsn/capture2.png
添加内部手风琴后,输出就像 https://www.dropbox.com/s/gdtnlznq44sqcag/capture3.png
我创造了一个小提琴。链接是http://jsfiddle.net/p3Dnp/ 任何帮助表示赞赏。谢谢