The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Centre text in php table
benprice234
post 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>

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
benprice234
post 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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Mar 28 2014, 01:30 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



QUOTE(benprice234 @ Mar 28 2014, 03:52 PM) *

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


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 02:47 AM