Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- 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(
- '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 /> ";
- echo $nameAr." => ";
- echo var_dump($valueAr);
- }
- echo "<br /><br />";
- }
- ?>
- // BELOW IS WHAT THE OUTPUT PRINT VAR STUFF LOOKS LIKE:
- 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 =>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement