Output a php multi-dimensional array to a html table

后端 未结 3 2030
温柔的废话
温柔的废话 2020-12-06 14:26

I have a form that has 8 columns and a variable number of rows which I need to email to the client in a nicely formatted email. The form submits the needed fields as a multi

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 15:06

    How about this?

    $keys = array_keys($_POST['order'][0]);
    echo "";
    foreach ($_POST['order'] as $order) {
      if (!is_array($order))
        continue;
      echo "";
    }
    echo "
    ".implode("", $keys)."
    ".implode("", $order )."

提交回复
热议问题