PHP syntax error “unexpected $end”

$result = mysql_query($sql, $connection) or die(mysql_error());
if ($result) {
    $msg = "<p>" .$_POST[table_name]." has been created!</p>";
}

you missing a } in your last if statement, and your for loop is missing a } too

for ($i = 0; $i < count($_POST[field_name]); $i++) {
    $sql .= $_POST[field_name][$i]." ".$_POST[field_type][$i];
    if ($_POST[field_length][$i] !="") {
      $sql .=" (".$_POST[field_length][$i]."),";
    } else {
        $sql .=",";
    }
} 

This error message means that a control structure block isn’t closed properly. In your case the closing } of some of your control structures like the for loop or the last if are missing.

You should use proper indentation and an editor that highlights bracket pairs to have a visual aid to avoid such errors.