Centre text in php table |
Centre text in php table |
benprice234 |
Mar 28 2014, 09:52 AM
Post
#1
|
Group: Members Posts: 3 Joined: 28-March 14 Member No.: 20,628 |
I have created a website that links to a php my admin database and displays the contents. All works perfectly however I cant get the text to display in the centre of the table. I have tried many different ways of doing this and my latest attempt is shown below. Have any of you got any suggestions.
echo "<tr><td text-align: center;><?item_id=$homeid>$homename</a>"; if (isset($_SESSION['logged_in'])) { ?> <td text-align: center;><a href="home.php?delete=<?php echo $homeid; ?>" onClick="return confirm('Are you sure you want to delete?')">Delete</a> <td text-align: center;><a href="edithome.php?item_id=<?php echo $homeid; ?>">Edit</a> <?php } } //end while ?> </table> <br> |
Frederiek |
Mar 28 2014, 10:03 AM
Post
#2
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
There is no text-align attribute on a TD. But it is a CSS property. So, try using: <td style='text-align: center;'> (watch out for overlapping single and double quotes).
BTW, be sure to close the TD and TR tags too, which I don't see in your snippet. |
benprice234 |
Mar 28 2014, 10:30 AM
Post
#3
|
Group: Members Posts: 3 Joined: 28-March 14 Member No.: 20,628 |
Worked Perfectly. Thank you very much Frederiek.
|
Christian J |
Mar 28 2014, 01:30 PM
Post
#4
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
I have created a website that links to a php my admin database Just to nitpick: phpMyAdmin is not a database, it's a control panel (written in PHP) for accessing a MySQL database. CODE <?item_id=$homeid>$homename</a>"; In addition to what Frederiek wrote, the part above seems incorrect --what's "item_id", and where's the link start tag? Also it's usually more practical to put CSS in stylesheets rather than using STYLE attributes. See also http://htmlhelp.com/reference/css/style-html.html |
Lo-Fi Version | Time is now: 18th April 2024 - 10:06 PM |