Skip to content

Instantly share code, notes, and snippets.

@mkroman
Created August 15, 2010 11:31
Show Gist options
  • Select an option

  • Save mkroman/525391 to your computer and use it in GitHub Desktop.

Select an option

Save mkroman/525391 to your computer and use it in GitHub Desktop.
<?php
$row = FALSE;
// show the first row in the table.
print "<tr>
<td colspan=\"3\" class=\"sechead\"><span>C</span>ontact <span>I</span>nfo</td>
</tr>";
// now foreach the bastards array...
foreach($contactArray as $key=>$value) {
if ($value == NULL || $key == "user_id" || $key == "pc_id" || trim($value) == "")
continue;
else {
// use array key to find out the field name
$fieldName = $contactInfoArray[$key];
// Then we can now use $value as well
print "<tr>
<td>&nbsp;</td>
<td width=\"30%\" class=\"celllineleft\">{$fieldName}</td>
<td width=\"50%\" class=\"celllineright\" colspan=\"2\">{$value}</td>
</tr>";
$row = TRUE;
}
}
var_dump($row);
if ($row == FALSE) {
print "<tr>
<td>&nbsp;</td>
<td width=\"30%\" class=\"celllineleft\">&nbsp;</td>
<td width=\"50%\" class=\"celllineright\" colspan=\"2\">User has not updated their contact information.</td>
</tr>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment