Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsWeb DesignWeb Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 21st, 2013, 08:41 PM
ewenifvn ewenifvn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2013
Posts: 1 ewenifvn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 50 sec
Reputation Power: 0
Line breaks between tables - mystery

Hey, all.

I have four tables set out on a PHP / HTML page.

The first, the third and the fourth table separate from each other fine, no problem.

The second will not. Table 2 sits on top of the the Table 3 and resists all efforts - I have tried many ways - to position it a line break apart from (i.e., above) Table 3.

Can someone please read the code here and tell me where I'm going wrong?

I'd appreciate it very much.


<?php // Table 1 Here, PHP starts again after stopping on line 2.
$ifvnName = 'Evelyn May Atkinson';
$listening = '3 / 60%';
$reading = '3 / 63%';
$writing = '2 / 50%';
$speaking = '2 / 62%';
$overall = ($listening + $reading + $writing + $speaking) /4;
?> <!-- NB - this PHP break must be here or it all goes haywire above AND below. -->
<!-- NB - AT THE MOMENT, THIS PAGE IS BEING STYLED BY THE CSS GLOBAL FILE, WHICH IS OVER-RIDING PHP IN COMMANDING COLUMN / CELL WIDTH. -->
<table border="1" cellpadding="10"> <!-- THESE TWO GIVE VERY BASIC HTML STYLING OF THE TABLE. The 2nd seems to pad the contents of each cell on all sides of the data in the cell.-->
<tr>
<th>IFVN Name</th><th>L</th><th>R</th><th>W</th><th>S</th><th>Overall</th>
</tr>
<tr>
<td><pre><?php echo $ifvnName ?></pre></td>
<td><pre><?php echo $listening ?></pre></td>
<td><pre><?php echo $reading ?></pre></td>
<td><pre><?php echo $writing ?></pre></td>
<td><pre><?php echo $speaking ?></pre></td>
<td><pre><span style="color:red"><?php echo $overall ?></span></pre></td>
</tr>
</table>

<?php // Table 2
$ifvnName = 'Evelyn May Atkinson';
$listening = '3 / 60%';
$reading = '3 / 63%';
$writing = '2 / 50%';
$speaking = '2 / 62%';
$overall = ($listening + $reading + $writing + $speaking) /4;
echo '<table border="1" cellpadding="5">';
echo '<tr><th>IFVN Name</th><th>L</th><th>R</th><th>W</th><th>S</th><th>Overall</th></tr>';
echo '<tr>';
printf('<td><pre>%s</pre></td><td><pre>%s</pre></td><td><pre>%s</pre></td><td><pre>%s</pre></td><td><pre>%s</pre></td><td><pre>%.1f</pre></td><br />', $ifvnName, $listening, $reading, $writing, $speaking, $overall);

// THE TABLE NOT HAVING A LINE BREAK BELOW IT MUST HAVE SOMETHING TO DO WITH THE PRINTF LINE ABOVE - IT'S THE ONLY DIFFERENCE BETWEEN THE THREE.
echo '<br />'; // Putting in a table break like this makes no difference to spacing. I admit defeat.
?>

<?php // Table 3
echo '<br />';

$name = 'HTML & PHP no printf';
$accountNumber = 1234;
$balance = 1443.22;

// NOTE: a closing tag is required when mixing PHP and HTML
?>
<table border="1" cellpadding="5">
<tr>
<th>Name</th>
<th>Account Number</th>
<th>Balance</th>
</tr>
<tr>
<td><pre><?php echo $name ?></pre></td> <!-- NB - This time, the HTML starts the table, but now see line 132, where PHP starts and PHP comes inside. -->
<td><pre><?php echo $accountNumber ?></pre></td>
<td><pre><?php echo $balance ?></pre></td>
</tr>
</table>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Development > Line breaks between tables - mystery


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap