Page 1 of 1

PHP Causing Problems with Table?

Posted: Fri Mar 26, 2010 4:30 pm
by carleihar
In most of my pages, I use an echo statement to display a table. In my header file, I have a div that displays a table with the users login information. For some reason the table isn't displaying like a table, instead its just a line. I just can't figure out what's wrong! Any help?

Code: Select all

<div class="login">
                        
                        
                        
                        <?
                        
                        include('config.inc.php');
                        require_once('mysqli_connect.php');
 
                        
                        if(!validate_login($_COOKIE['username'], $_COOKIE['password'])) {  
                              echo 'Sorry, you\'re not logged in. Go <a href="login.php">here</a>';
                              mysqli_close($dbc);
                              include ('includes/footer01.inc.php');
                              exit();  
                        } else {
                        
                            $EG = getUsersMoney();
                    
                        
                            echo'<table>
                                    <tr>
                                        <td><span class="loginBold">UN: </span></td>
                                        <td>' . $_COOKIE['username'] . '</td>
                                    </tr>
                                    <tr>
                                        <td><span class="loginBold">EG: </span></td>
                                        <td>' . $EG . '</td>
                                    </tr>
                                    <tr>
                                        <td><span class="loginBold"><a href="http://liveequian.com/logout.php">Logout</a></span></td>
                                    </tr>
                                </table>';
 
                        }
                        ?>
                        
                        
                        </div>

Re: PHP Causing Problems with Table?

Posted: Fri Mar 26, 2010 4:42 pm
by F00Baron
$EG must have some html that's messing with the table.
Also you should put

Code: Select all

<td colspan="2">
for the last row.

Re: PHP Causing Problems with Table?

Posted: Fri Mar 26, 2010 6:02 pm
by carleihar
No, that doesn't work because it still doesn't display the table data even without both variables.

Re: PHP Causing Problems with Table?

Posted: Sat Mar 27, 2010 11:52 am
by social_experiment

Code: Select all

<?php echo '<table>
                                    <tr>
                                        <td><span class="loginBold">UN: </span></td>
                                        <td>Joe</td>
                                    </tr>
                                    <tr>
                                        <td><span class="loginBold">EG: </span></td>
                                        <td>' . $EG . '</td>
                                    </tr>
                                    <tr>
                                        <td><span class="loginBold"><a href="http://liveequian.com/logout.php">Logout</a></span></td>
                                    </tr>
                                </table>';?>
If you parse just the above code the table displays correct, so it's possible that something inside '$EG = getUsersMoney();' is adding additional markup to the html, throwing out the table (like F00Baron mentioned).

Could you paste the code for 'getUsersMoney()' ?