SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Switch Kills CSS!

    Well, this is a new problem for me. If you visit http://www.geobop.org/about/guide/world/index.php, you'll see a database table with color coded cells and other CSS styles.

    But if you use the PHP switch to sort any of the columns (or just type in
    http://www.geobop.org/about/guide/wo...&submit=Submit), all the CSS styles disappear. It appears to "erase" certain elements in the head section.

    I've tried putting the CSS styles in the same page's head section, as well as simply linking to a separate style sheet with the same result.

    It's such a bizarre problem, I'm not even sure where to begin troubleshooting it. I don't have the same problem with similar pages on my websites.

    I posted the html below, deleting most of the irrelevant stuff. Thanks for any tips.

    PHP Code:
    <?php
    include ($_SERVER['DOCUMENT_ROOT']."/doctype.php");
    include (
    $_SERVER['DOCUMENT_ROOT']."/images/bg/a1.php");
    echo 
    '<head>';
    include (
    $_SERVER['DOCUMENT_ROOT']."/a1/inc/head/a1.php");
    echo 
    '</head>';
    ?>
    <body class="<?php echo "$mypage?>" id="<?php echo "$mycode?>">

    <div class="formdiv">
      <form action="index.php" method="get">
        <select name="order">
          <option value="1">RemoteWorld</option>
          <option value="2">NF</option>
          <option value="3">Name</option>
          <option value="4">Name</option>
        </select>
        <input type="radio" name="direction" value="0">
        Ascending
        <input type="radio" name="direction" value="1">
        Descending
        <input type="submit" name="submit" value="Submit">
      </form>
    </div>
    <?php
    $colors 
    = array( '#eee''''#ffc''''#cff''''#cfc''' );
    $n=0;
    $size=count($colors);

    $result mysql_query('select count(*) from famarea');
    if ((
    $result) && (mysql_result ($result 0) > 0)) {
    } else {
    die(
    'Invalid query: ' mysql_error());
    }
    {
    $order = isset($_REQUEST['order']) ? intval($_REQUEST['order']) : 0;
    switch(
    $order)
    {
       case 
    1:
           
    $order 'RemoteWorld';
           break;
       case 
    2:
           
    $order 'NF';
           break;
       case 
    3:
           
    $order 'Name';
           break;
       default:
           
    $order 'Name';
           break;
    }
    if (isset(
    $_REQUEST['direction']) && intval($_REQUEST['direction'])) {
    // if (isset($_REQUEST['direction']) && intval($_REQUEST['direction'])) {
    $direction ' DESC';
    } else {
        
    $direction '';
    }

    /*

    $res = mysql_query ('SELECT * from famarea as F
     WHERE  RemoteWorld <> "0" AND RemoteWorld IS NOT NULL
     ORDER BY F.' . $order . $direction) or die (mysql_error());

    echo '<table class="sortphp" id="tab_eco_na" style="margin-left: auto; margin-right: auto">
             <thead>
                <tr><th style="padding-left: 10px; background: #090; color: #fff;">Remote</th>
                <th style="padding-left: 10px; background: #c09; color: #fff;">Name</th></tr>
             </thead>
             <tbody>';
    //<!-- BeginDynamicTable -->
    $rowcounter=0;
    while ($row = mysql_fetch_array ($res))
    {
         $c=$colors[$rowcounter++%$size];
         echo "<tr class=\"$class\" style=\"background-color:$c\"><". $_SERVER['PHP_SELF'] .'?id='. $row['IDArea'] .">
        <td class=\"tdname\" style=\"padding: 0px 5px 0px 10px\"><a href='". $row[''] ."'>". $row['RemoteWorld'] ."</a></td>
        <td class=\"$classK\" style=\"padding: 0px 5px 0px 10px\">". $row['Name'] ."</td></tr>\n";
    }
    }
    ?>
    </tr>
    </tbody>
    </table>
    </body>
    </html>

  2. #2
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please disregard this thread. I fixed the problem by changing <form action="index.php" method="get"> to <form action="remote.php" method="get">.

    This has tripped me up several times. Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •