Support » Plugin: Custom Content Type Manager » submitting relational values of a post type to custom field of another post type

  • Resolved shishirumrao


    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" />
    $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' ); ?>
    <!-- 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

Viewing 1 replies (of 1 total)
  • Plugin Contributor fireproofsocks


    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.

Viewing 1 replies (of 1 total)
  • The topic ‘submitting relational values of a post type to custom field of another post type’ is closed to new replies.