submitting relational values of a post type to custom field of another post type (1 post)

  1. shishirumrao
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic