Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-08-2013, 02:06 AM   PM User | #1
The reaper
Regular Coder

 
Join Date: Oct 2009
Location: Florida
Posts: 153
Thanks: 16
Thanked 2 Times in 2 Posts
The reaper is an unknown quantity at this point
How to generate a table with unique ids?

Hello there,

I've been trying to figure out how to make a table, in this case it's a 50x50 table with each one having a different "title" tag here is the first one:

<td style="background-color:#0000BA;"><a href="page#" title="1"><font color="#000000"><strong>&nbsp;</strong></font></td>
<td style="background-color:#0000BA;"><a href="page#2" title="2"><font color="#000000"><strong>&nbsp;</strong></font></td>

I'm not really sure how to do this, I am thinking it is possible with a while loop, but I don't know how to add the variables and limit the row and column count.

Any help would be greatly appreciated!
The reaper is offline   Reply With Quote
Old 01-08-2013, 03:25 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
1. There is no such thing as a font tag - there used to be but it was deleted from HTML in 1997. You should replace it with a span tag and attach CSS instead.

2. You can't use numbers by themselves after a # in the href as the value after the # points to an id in the page and ids must start with a letter.

3. To generate the code in a while loop you'd need to run the loop using PHP. As you have a fixed number of entries you want for each difection a for loop would work better than a while loop. See http://php.net/manual/en/control-structures.for.php
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 01-08-2013, 04:47 AM   PM User | #3
The reaper
Regular Coder

 
Join Date: Oct 2009
Location: Florida
Posts: 153
Thanks: 16
Thanked 2 Times in 2 Posts
The reaper is an unknown quantity at this point
Ah I see. I just had the numbers in the link after the "#" just to clarify. Thank you for pointing out the font tag. For loops, am I looking for a nested loop?
The reaper is offline   Reply With Quote
Old 01-08-2013, 06:03 AM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Yes, the inner loop would create the td tags for the one row and the outer loop would create the tr tag for the row and then call the inner loop.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Users who have thanked felgall for this post:
The reaper (01-08-2013)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:45 PM.


Advertisement
Log in to turn off these ads.