Display array onto html table

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shadowrider50
Forum Newbie
Posts: 5
Joined: Sat Jan 28, 2012 3:00 am

Display array onto html table

Post by Shadowrider50 »

How can i display an array onto a html table?
The array i am trying to put onto a table is being pulled from another server.
If you want to see what it's like at the moment, you can see here
"and just pick the 4 checkboxes and input into the text box "Shadowrider50".
It looks very messy without a table or some sort of organization
User avatar
StathisG
Forum Newbie
Posts: 14
Joined: Sat Mar 13, 2010 7:15 pm
Location: UK

Re: Display array onto html table

Post by StathisG »

You'll have to iterate through the array using for or foreach (check the examples; they'll help you a lot) and display its content the way you want in a <table>.
Shadowrider50
Forum Newbie
Posts: 5
Joined: Sat Jan 28, 2012 3:00 am

Re: Display array onto html table

Post by Shadowrider50 »

Hi,
Thanks for the answer,

i just read up on how to reference single elements from arrays and i've got it working now :)

I'm using it this way now

Code: Select all

$trophyplatinum = $getCount["0"][platinumtotal];
$getCount has the array stored of trophy information and i just store a single part of that array into $trophyplatinum.
I do the same for all other parts of the array.
This way i can use them anywhere easily by just calling that variable
Post Reply