Why is my css not displaying?

Hi, I am setting up I guess a very similar structure to MVC, but I am finding when I am passing a $_GET variable, with clean url, I am finding that the data is being parsed and I am able to use that variable, however, when the page is displayed, it seems to be missing the css layout, yet when I go into page source it appears to be getting it.

I’m not even sure what to display as code to assist. - Clear as mud?? - Any assistance would be greatly appreciated.

E.g: localhost/myurl/page/variable

If I have localhost/myurl/page - the page displays, but when I have the /variable there, the page displays the data from that variable, but not css.

Hope this helps.


Hi, could you post the code of the page in question please?


here is the .htaccess code:

RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)$ index.php?page=$1
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1
RewriteRule ^(roundSelection)/(.*)$ index.php?page=$1&roundID=$2

Here is my page I’m calling code:

                                if (isset($_GET["roundID"])) {
                                    $roundID = $_GET["roundID"];
                                    if(($roundID <= 0) || ($roundID >= 27)) {
                                        $roundID = 1;
                                } else {
                                    $roundID = 1;
                                    <!-- Main Content -->
                                            <h2>Round Selection</h2>
                                            <h3>This is the view for Round <?php echo $roundID; ?> </h3>
                                            <p>Please select your Round</p>
                                                        $getRoundId = getAllRounds();
                                                        foreach ($getRoundId as $round) {                                                            
                                                            echo "<a name='roundID' href=roundSelection/".$round["id"].">".$round["id"]."</a> | ";
                                        $games = getGames($roundID);
                                        <div id="tablewrapper">
                                                    <th colspan="2">Home Team</th>
                                                    <th colspan="2">Away Team</th>
                                                foreach($games as $game) { 
                                                    echo "<tr>
                                                            <td><input type='radio' name='".$game["gameID"]."' value='".$game["teamOne"]."'></td>
                                                            <td><img src='images/teamLogo/small/".$game["teamOneImage"].".png' /></td>                                                        
                                                            <td><img src='images/teamLogo/small/".$game["teamTwoImage"].".png' /></td>
                                                            <td><input type='radio' name='".$game["gameID"]."' value='".$game["teamTwo"]."'></td>

And here is my index page:


// place round id to test - this will be declared on live version by getting the current round id from database
$_SESSION["roundID"] = 1;

// include required config and database files

if(isset($_POST)) {
// handle any post that comes in
    $resultFromPost = handlePost($_POST);

// once the user goes off the landing page
if(isset($_GET["page"])) {
    $page = pageName($_GET["page"]);
} else {
    $page = "home";

// begin the page


// end page

I suspect the problem is that you’re linking to your CSS file with a relative path.

If your link tag is something like <link href="css/style.css" rel="stylesheet"> then when you’re on a top-level page (like home) the browser is looking for localhost/myurl/css/style.css, but as soon as you navigate to localhost/myurl/roundSelection/6 then the browser will now be looking for localhost/myurl/roundSelection/css/style.css.

Thanks fretburner I’ll give that a go and let you know how it turns out.

BJ Duncan