Php ACF表单-如何使用多数组添加\u post\u meta?

Php ACF表单-如何使用多数组添加\u post\u meta?,php,arrays,wordpress,forms,advanced-custom-fields,Php,Arrays,Wordpress,Forms,Advanced Custom Fields,我有一个问题,希望对初学者来说不要问太多。它基本上是一个下拉框,让你选择一辆车并将你的名字提交到列表中。稍后我将添加删除功能以及代码清理 它是什么:它是一个下拉式表单,允许您选择。我正在尝试获取表单,以便将所选的和登录的用户名提交到如下数组: entries => 0 => string 'Mercedes SLS AMG GT3' (length=20) <- the <option> chosen string 'John Doe' (length=2

我有一个问题,希望对初学者来说不要问太多。它基本上是一个下拉框,让你选择一辆车并将你的名字提交到列表中。稍后我将添加删除功能以及代码清理

它是什么:它是一个下拉式
表单,允许您选择
。我正在尝试获取表单,以便将所选的
和登录的用户名提交到如下数组:

entries =>
     0 =>
string 'Mercedes SLS AMG GT3' (length=20) <- the <option> chosen
string 'John Doe' (length=20) <- the user's name
     1 =>
string 'Audi GT3' (length=20) <- the <option> chosen
string 'Peter Smith' (length=20) <- the user's name

请澄清一下,您是否已正确保存了数据。我从get_post_自定义调用中看到您正在检索保存的元数据。您需要如何处理这些元数据?请澄清一下,您是否已正确保存了数据。我从get_post_自定义调用中看到您正在检索保存的元数据。您需要如何处理这些元数据?
<!-- Series Cars Stuff -->
<?php

$posts = get_field('series_cars_reference');
if( $posts ): ?>
    <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
        <?php setup_postdata($post); ?>
            <form name="choose_car" method="POST" action="">   
            <?php
            $rows = get_field('cars');
            if($rows) {
                echo '<select name="cars">';
                foreach($rows as $row)
                {
                    echo '<option name="cars" value="' . $row['car'] . '">' . $row['car'] . '</option>';
                }
            echo '</select>';
            echo '<input type="submit" name="submit" value="Submit"/>';
            }
        $current_user = $current_user->display_name;            
        $selectOption = Array(
          'entry' => array(
            'name' => $current_user,
            'car' => $_POST['cars'],
        ));
echo '<pre>'; print_r($selectOption);echo '</pre>';
            if(isset($_POST['submit'])){
                add_post_meta( get_the_ID(), 'entries', $selectOption );
            }
            ?>
            </form>

<!-- SHOW ALL POST DATA - VAR DUMP PRINT -->   
<h3>All Post Meta</h3>
<?php $getPostCustom=get_post_custom(); // Get all the data ?>
<?php
    foreach($getPostCustom as $name=>$value) {
        echo "<strong>".$name."</strong>"."  =>  ";
        foreach($value as $nameAr=>$valueAr) {
                echo "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                echo $nameAr."  =>  ";
                echo var_dump($valueAr);
        }
        echo "<br /><br />";
    }
?>
entries =>
     0 =>
string 'a:2:{s:4:"name";s:5:"admin";s:3:"car";s:20:"Mercedes SLS AMG GT3";}' (length=67)
     1 =>
string 'a:2:{s:4:"name";s:5:"admin";s:3:"car";s:20:"Mercedes SLS AMG GT3";}' (length=67)
     2 =>
string 'a:2:{s:4:"name";s:5:"admin";s:3:"car";s:20:"Mercedes SLS AMG GT3";}' (length=67)
     3 =>
string 'a:2:{s:4:"name";N;s:3:"car";s:20:"Mercedes SLS AMG GT3";}' (length=57)
     4 =>
string 'a:2:{s:4:"name";N;s:3:"car";s:20:"Mercedes SLS AMG GT3";}' (length=57)
     5 =>