WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Type Manager
[resolved] submitting relational values of a post type to custom field of another post type (2 posts)

  1. shishirumrao
    Member
    Posted 1 year ago #

    Hi,
    I'm preparing a small quiz module.
    This is my code

    <!-- New Post Form -->
    <div id="postbox">
    <form id="new_post" name="new_post" method="post" action="">
    <p><label for="title">Title</label><br />
    <input type="hidden" id="title" value="<?php the_title(); ?>" tabindex="1" size="20" name="title" />
    </p>
    <?php
    $my_array = get_custom_field('selectquestions:to_array');
    foreach ($my_array as $item) {
    	$args = array(
    	'p'      => $item,
    	'order'    => 'ASC'
    	);
    	echo '<h5>'.get_the_title($item) . '</h5><br>';
    	echo '<input type="radio" value="A" id="opt_A" name="opt_'.$item.'" />'.get_post_meta($item, 'textoptiona', true).'<br>';
    	echo '<input type="radio" value="B" id="opt_B" name="opt_'.$item.'" />'.get_post_meta($item, 'textoptionb', true).'<br><hr>';
    } ?>
    
    <input type="submit" value="Post Review" tabindex="40" id="submit" name="submit" />
    <input type="hidden" name="action" value="new_post" />
    <?php wp_nonce_field( 'new-post' ); ?>
    </form>
    </div>
    <!-- New Post Form ENDS -->

    which displays
    question 1
    [radio] Option A
    [radio] Option B

    question 2
    [radio] Option A
    [radio] Option B

    and so on..

    now I want the values submitted by user to be stored somthing like this

    [id of question1][option selected by user][right option of question1],
    [id of question2][option selected by user][right option of question2],... and so on in one field.

    or any other way to store options so that a report can be generated at end ?

    Thanks in Advance

    http://wordpress.org/extend/plugins/custom-content-type-manager/

  2. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Really, this has nothing to do directly with the CCTM plugin, so I can't give you many pointers. If you're doing something as specific as questions and reports, I would recommend you look towards a dedicated framework -- that's a lot of stuff to try and make WordPress do and it's not built for anything that complex. Modeling your data is somewhere between an art and a science, so my best advice is to figure out your reporting queries first (groupings, sortings, etc) and that should help tell you how your data will need to be stored.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic