function table_with_form($action = "", $header = array(), $data = array(), $u_id = "u_id") { $return = "<form action='{$action}' method='POST'>"; $return .= "<table>"; $return .= "<tr>"; foreach ($header as $key => $value) { if ($key == $u_id) { continue; } $return .= "<td>" . $key . "</td>"; } $return .= "</tr>"; foreach ($data as $row) { $return .= "<tr>"; foreach ($header as $key => $value) { if ($key == $u_id) { continue; } if (strtolower($value) == "check") { $return .= "<td>" . GuiHelper::checkbox("check[]", $row[$key], $row[$u_id]) . "</td>"; } if (strtolower($value) == "text") { $return .= "<td>" . $row[$key] . "</td>"; } } $return .= "</tr>"; } $return .= "</table>"; $return .= GuiHelper::submit_button(); $return .= "</form>"; return $return; }