1

我的css在php代码之后不起作用。我必须在 elseif 之后重写整个 html 代码才能使格式正常工作。我已经尝试在 's 中插入 html 代码,但它仍然不会按应有的方式设置样式。我的导航也不会显示。我不明白。

if(isset($_POST['sby'])){
  $value = $_POST['sby'];
  if(isset($_POST['search'])){
      if($value == 'cname'){?>
            <!doctype html>
            <head>
            <meta charset="utf-8">
            <title>Untitled Document</title>
            <link href="../../css/style.css" rel="stylesheet" type="text/css" />
            <!--[if lt IE 9]>
            <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
            <![endif]-->
            </head>

            <body>

            <div class="container">
            <header>
              <a href="home.php"><img src="../../img/Intellibest-EMM Logo.jpg" alt="Insert Logo Here" name="Insert_logo" width="180" height="141" id="Insert_logo" style="background-color: #C6D580; display:block;" /></a>
            </header>
            <div class="sidebar1" style="height:auto">
              <ul class="nav">
                <li><a href="../home.php">Home</a></li>
                <li><a href="../look.php">Look For</a></</li>
                <li><a href="../make.php">Make Something</a></li>
                <li><a href="../settings.php">Settings</a></li>
              </ul>
            </div>
            <table>
              <thead id="tbl">
                  <tr>
                  <td><h3>Company Name</h3></td>
                  </tr>
              </thead>
                <?php do { ?>
                <tbody id="result">
                <tr>
                <td>
                  <?php echo $row_get_cname['Company Name'];?>
                </td>
                <?php } while ($row_get_cname = mysql_fetch_assoc($get_cname)); ?>
              </tr>
              </table>
          <?php }
          else if($value == 'ename'){?>

              <table>
              <thead id="tbl">
                  <tr>
                  <td><h3>First Name</h3></td>
                  <td><h3>Last Name</h3></td>
                  <td><h3>Position</h3></td>
                  <td><h3>Company Name</h3></td>
                  </tr>
              </thead>

                  <?php do { ?>
                      <tbody  id="result">
                      <tr>
                      <td>
                          <?php echo $row_get_ename['First Name'].' '.$row_get_ename['Last Name'].'<br>'.$row_get_ename['Position'].'<br>'.$row_get_ename['client companies (pana)`.`Company Name'];?>
                      </td>
                  <?php } while ($row_get_ename = mysql_fetch_assoc($get_ename)); ?>
             </tr>
             </tbody>
             </table>
          <?php }
          else if($value == 'iname'){

              echo "<table>
               <thead id=tbl>
                  <tr>
                  <td><h3>Company Name</h3></td>
                  <td><h3>Industry</h3></td>
                  </tr>
              </thead>";
                do { 
                echo "<tbody id=result>
                <tr>
                <td>";
                echo $row_get_iname['Company Name'].'</td><td>'.$row_get_iname['Industry'];
                echo "</td>";
                 } while ($row_get_iname = mysql_fetch_assoc($get_iname));
              echo "</tr>
              </tbody>
              </table>";    
      }
      else{
          echo "Please enter a valid search quer";  
      }
  }
  else{
      echo "Please define search";
  }
}
else{
  echo "Please enter a search query";
}
4

3 回答 3

2

试试这个:

 <!doctype html>
 <head>
 <meta charset="utf-8">
 <title>Untitled Document</title>
 <link href="../../css/style.css" rel="stylesheet" type="text/css" />
 <!--[if lt IE 9]>
 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
 <![endif]-->
 </head>

 <body>

 <div class="container">
 <header>
  <a href="home.php"><img src="../../img/Intellibest-EMM Logo.jpg" alt="Insert Logo Here" name="Insert_logo" width="180" height="141" id="Insert_logo" style="background-color: #C6D580; display:block;" /></a>
</header>
<div class="sidebar1" style="height:auto">
  <ul class="nav">
    <li><a href="../home.php">Home</a></li>
    <li><a href="../look.php">Look For</a></</li>
    <li><a href="../make.php">Make Something</a></li>
    <li><a href="../settings.php">Settings</a></li>
  </ul>
</div>
<?php
if(isset($_POST['sby'])){
  $value = $_POST['sby'];
  if(isset($_POST['search'])){
      if($value == 'cname'){?>

这样,无论 $value 的值如何,您的页面顶部都会显示出来。

于 2012-10-26T04:08:26.397 回答
0

我有一个类似的问题。如果它在任何其他类别下,<a href>那么不要将样式设置为正常id,但您必须将其与类别相同#something a:hover ,希望有帮助。

于 2016-06-15T00:27:02.067 回答
-1

尝试编辑这部分:

href="../../css/style.css"

并将其更改为

href="css/style.css"

或者您可以尝试手动操作

于 2012-10-26T04:06:27.900 回答