Skip to content

Instantly share code, notes, and snippets.

@incubs
Created December 30, 2016 16:11
Show Gist options
  • Save incubs/1f96d5edbca927ff1278ed3af420fe3c to your computer and use it in GitHub Desktop.
Save incubs/1f96d5edbca927ff1278ed3af420fe3c to your computer and use it in GitHub Desktop.
implode
<?php if (isset($_POST["table"])) { ?>
<div class="container">
<table class="table-condensed table-hover table-bordered" >
<tr>
<?php
if(!empty($_POST))
{?>
<th><?php echo implode('</th><th>', array_keys($_POST)); ?></th>
<?php }
?>
</tr>
<tr>
<?php
if(!empty($_POST))
{
foreach ($_POST as $tablehead => $value)
{
?>
<td><?php if (!empty($value))
{
if (is_array($value)) {
foreach ($value as $item) {
echo $item." ";
}
}
else
{
echo $value;
}
}?></php></td>
<?php
}
}
?>
</tr>
</table>
</div>
<?php }?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment