Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: PHP Class wrecking HTML/CSS in IE

  1. #1

    PHP Class wrecking HTML/CSS in IE

    Okay so I have a PHP class that I'm calling, and it's taken me a week to figure out it's this specific class which is causing all the issues, but here's what's up:

    At the top of my HTML file, above the head and html declaration and doctype and all that happy stuff I call my function like this:
    PHP Code:
    include('library/classes/Employees.php'); 
    I assume this is not the problem because I call two other classes and they manage to break anything.

    However after this declaration IE just screws up my whole design. I, for the life of me, can't figure out what the issue is. It's like something in the class is throwing out some extra characters or something but the outputted HTML seems to be fine.

    The offending class is as follows:
    PHP Code:
    <?php

    class Employees
    {

        public function 
    dropdown() {
            
            
    $getEmployees mysql_query("SELECT * FROM employees ORDER BY lastName ASC");
            
            while(
    $employeeList mysql_fetch_array($getEmployees)) {
                    
                echo 
    "<option value='" $employeeList['id'] . "'>" $employeeList['lastName'] . ", " $employeeList['firstName'] . "</option>";
            } 
        }
        
        public function 
    orderedlist() {
        
            
    $getEmployees mysql_query("SELECT * FROM employees ORDER BY lastname ASC");
            
            while (
    $employeeList mysql_fetch_array($getEmployees)) {
                
                echo 
    "<li><a href='" $employeeList['id'] . "'>" $employeeList['firstName'] . " " $employeeList['lastName'] . "</a></li>\r\t";        
            }
        }
        
    }

    ?>
    I mean it's a pretty tame class, hardly does anything at this point. But for some reason it's just wrecking everything.

    Does anyone have any thoughts on why this would happen?

  2. #2
    Well.. since i can't really see anything else BUT this class I'm gonna go ahead and say, both functions are missing their parent elements, some where if it's not hardcoded in the markup you need to have. <select></select> and <ul></ul> (or any other list tags) to put around those. Seems like it shouldn't mess it up, BUT the only other thing I can think is that it's erroring out and your error colors are either the same as the bg so look at the code... or they're being supressed.
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  3. #3
    There's no errors, everything is reporting right now, if there were errors Firefox would should them as well. Also the selects and uls are hard coded. It's something that's happening before the code even gets to the HTML. I'll post screens in a bit if no one has any ideas.

  4. #4
    Good


    Bad


    Same source immediately before any html, which is:
    PHP Code:
    include('library/connect.php');
    include(
    'library/classes/Employees.php');
    include(
    'library/classes/Timestamp.php');


    $Timestamp = new Timestamp();
    $Employees = new Employees(); 
    This causes everything to be fine:
    PHP Code:
    include('library/connect.php');
    /*include('library/classes/Employees.php');*/
    include('library/classes/Timestamp.php');


    $Timestamp = new Timestamp();
    /*$Employees = new Employees();*/ 
    When I view the source in IE I see this
    HTML Code:
    []
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    I typed the [] at the top there, but pretend it's the little box symbol that gets spit out by Windows when it can't find the font or character or whatever. I assume the little box is throwing it off as it doesn't show up in Firefox. It's like the actual file is encoded wrong or something.


    I'm at a complete loss here.

  5. #5
    hey, after copying your script into dreamweaver I noticed there is a space after you close the php tag "?> ", I'm not sure if its just because I copied from the page or what, but I had a space at the beggining of a php file like " <?php" which messed a lot of things up for me.

    You could also try copying the files contents and just making a new file, and pasting the contents into that.

  6. #6
    I tried the new file thing a bunch of times, I'm going to look into the stray space in a bit though, thanks for the idea

  7. #7
    I have no idea what causing the problem; but I am interested to see what the solution is. Best luck on solving it.
    COLOURlovers | Member #2 of the kirupa XBox 360 Club
    "I think most people would agree that your computer breaking is a Christmas miracle." ~shane-c to Timmytots

  8. #8
    Try commenting out the output in the class so it is:
    PHP Code:
    <?php

    class Employees
    {

        public function 
    dropdown() {
            
            
    $getEmployees mysql_query("SELECT * FROM employees ORDER BY lastName ASC");
            
            while(
    $employeeList mysql_fetch_array($getEmployees)) {
                    
                
    //echo "<option value='" . $employeeList['id'] . "'>" . $employeeList['lastName'] . ", " . $employeeList['firstName'] . "</option>";
            

        }
        
        public function 
    orderedlist() {
        
            
    $getEmployees mysql_query("SELECT * FROM employees ORDER BY lastname ASC");
            
            while (
    $employeeList mysql_fetch_array($getEmployees)) {
                
                
    //echo "<li><a href='" . $employeeList['id'] . "'>" . $employeeList['firstName'] . " " . $employeeList['lastName'] . "</a></li>\r\t";        
            
    }
        }
        
    }

    ?>
    PHP commands when run successfully shouldn't even return a success message, alert or any output so shouldn't affect the render at all... but that's obvious. Sure it's that class?

  9. #9
    Quote Originally Posted by Neolumi View Post
    hey, after copying your script into dreamweaver I noticed there is a space after you close the php tag "?> ", I'm not sure if its just because I copied from the page or what, but I had a space at the beggining of a php file like " <?php" which messed a lot of things up for me.

    You could also try copying the files contents and just making a new file, and pasting the contents into that.
    On a side note, a whitespace before <?(php) will be outputted but a whitespace character after ?> will not until the next line.


    The code you posted with the class, is that all the file included contains?
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

  10. #10
    Yeah, and I forgot to mention when I comment out everything except the php opening and closing tags I still get the weird issue. Which is why I think it's some weird encoding thing.

  11. #11
    So I tried copy and pasting to a new file and it still didn't work, then I rewrote a new file from scratch and it worked for whatever reason.

    I'm wondering if Notepad++ is pissing in my cheerios or something. I wish there was a decent editor for Windows.

  12. #12
    cause it prolly saved as ascii instead of binary or vica versa. i've had that happen to me once or twice.
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  13. #13
    How do I check that in Winders?

  14. #14
    It’s good to leave off the closing PHP tag when in PHP-only files — that way, you’ll never accidentally have trailing whitespace after the tag. Try that!


    K-Emmys-06: Best Footer; and K-Emmys-06: Most Active Member

  15. #15
    That's a cool idea, I like that.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012