0

我正在编辑此页

如果您看一下,您会发现我遇到的问题。

底部 2 个链接与顶部 3 个链接不匹配。

这是代码:

 <?PHP 
include_once('include/connection.php'); 
include_once('include/article.php');

$category = new category;
$articles = $category->fetch_all();


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Xclo.mobi</title>

<link type="text/css" rel="stylesheet" href="other.css" />
<link rel="apple-touch-icon" href="homescreen.png" />
<link href="startup.png" rel="apple-touch-startup-image" />


<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-34172259-1']);
  _gaq.push(['_setDomainName', 'xclo.co.uk']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body>

<?php include_once('header.php'); ?>


<div id="content">
<ul class="pageitem">
<li class="button"><input name="Submit" value="Food" onclick="window.location='food.html' " type="submit" /></li></ul>
<ul class="pageitem">
<li class="button"><input name="Submit" value="Make A Change" onclick="window.location='change.html' " type="submit" /></li></ul>
<ul class="pageitem">
<li class="button"><input name="Submit" value="Finance" onclick="window.location='insurance.html' " type="submit" /></li></ul>

<?php foreach ($articles as $article) { ?>

<ul class="pageitem"><li class="button">    
<a href="list.php?id=<?php echo $article['promo_cat']; ?>">
<input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>" style="text-decoration: none;"/>
</li></ul>
          </a> <?php } ?>

</div>
<br><center>
<SCRIPT charset="utf-8" type="text/javascript" src="http://ws-eu.amazon-adsystem.com/widgets/q?rt=tf_sw&ServiceVersion=20070822&MarketPlace=GB&ID=V20070822%2FGB%2Fxclo-21%2F8002%2Fc2cd2f40-ca29-49bc-add9-6cf16307e855"> </SCRIPT> <NOSCRIPT><A HREF="http://ws-eu.amazon-adsystem.com/widgets/q?rt=tf_sw&ServiceVersion=20070822&MarketPlace=GB&ID=V20070822%2FGB%2Fxclo-21%2F8002%2Fc2cd2f40-ca29-49bc-add9-6cf16307e855&Operation=NoScript">Amazon.co.uk Widgets</A></NOSCRIPT></center>

<?php include_once('footer.php'); ?>


</body>
</html>

前 3 个是手动 HTML 输入,但后 2 个是从我的数据库中获取的。

我的问题是这样的:

这两种类型都有相同的“li”和“ul”标签。那么为什么它们看起来不一样呢?

谢谢你。

编辑

底部 2 的值为:

   <?php foreach ($articles as $article) { ?>

    <ul class="pageitem"><li class="button">
    <a href="list.php?id=<?php echo $article['promo_cat']; ?>">
    <input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>" style="text-decoration: none;"/>
    </li></ul>
              </a> <?php } ?>

但它需要删除下划线。

4

2 回答 2

0

您的 html 格式不正确

<?php foreach ($articles as $article) { ?>
    <ul class="pageitem">
        <li class="button" style="text-align:center;font-weight: bold;">
        <a href="list.php?id=<?php echo $article['promo_cat']; ?>">
        <?php echo $article['promo_cat']; ?>
        </a>
        </li>
    </ul>
<?php } ?>
于 2013-07-20T18:52:31.003 回答
0

我已经对此进行了排序。

请再次查看我的链接。

我使用的代码是这样的。

<?php foreach ($articles as $article) { ?>

<style>
a:link, a:visited, a:hover{color:black; text-decoration:none;}
</style>


<ul class="pageitem"><li class="button">   
<a href="list.php?id=<?php echo $article['promo_cat']; ?>">
<input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>"/>
</li></ul>
          </a> <?php } ?>

请给这个。

谢谢你。

于 2013-07-20T19:06:17.800 回答