I’m dipping my toe into arrays, multidimensional no less. My code is doing nothing, renders nothing in the browser except the empty shell of a doc in source (missing the meta tags for some reason). My book and google aren’t helping in this case.
My objective is to build a row of column headers with sorting links.
This all takes place within <tr></tr> tags, and the page worked fine when I built the rows manually – it just seemed more efficient and maintainable to built the header columns from an array.
[code=php]
$columns = array( // assign associative array for each column (fieldname, label):
array (‘Servername’,’Server’),
array (‘Platform’,’Platform’),
array (‘role’,’Role’),
array (‘primary’,’Primary’),
array (‘secondary’,’Secondary’),
array (‘uporder’,’UPOrder’),
array (‘ip’,’IP Address’),
array (‘rack’,’Rack’),
array (‘rebootlist’,’Reboot’),
array (‘barcode’,’Barcode’),
array (‘manufacturer’,”),
array (‘model’,’Model’),
array (‘hwclass’,’HW’),
array (‘status’,’Status’),
) // end outer ($columns) array
//build the column headers with sort links as appropriate
foreach ($column as $header) {
echo “<td class=’cell1′ style=’border-bottom:navy;’><b>”;
echo “<a style=’text-decoration:none;’ href=’$PHP_SELF?sortby=$header[0]&order=$altorder’>$header[1]</a>”;
echo “</b></td>n”;
} // end foreach
Can anyone tell me what I’ve munged up?