Jump to content

Recommended Posts

Ok this might be a bit hard to explain but it I'll give it my best shot!

 

I have a panel where a user can create questions, and he can add as many questions as he wants.

Each question has the option to include images as answers, those images are taken from categories, so for example a user can choose to include these categories; carpet, wood, stone.

 

He can also create his own drop downs for each questions by simply typing whatever value he wants and it will add itself.

 

All this is already done, the user can simply press on Add Another Question and fill it up again, my only problem is how to collect all of that data. I could make all of the elements arrays but I don't think that would work because I still need to collect all of the image categories for each question as well as all of the drop down (if a drop down is created ) entries for each question.

 

I just need help with the logic behind all of this, I can't collect all of the information for 1 question quite easily but when more questions are added I'm not exactly sure how to collect them.

 

 

 

question, answer (textfield)

question, answer1, answer2, answer3 (radio)

question, answer1, answer2, answer3 (select)

question, answer1, answer2, answer3 (select, multiple)

question, answer1, answer2, answer3 (checkbox)

 

types (id, type) // values (1, 'text'), (2, 'radio'), (3, 'select'), (4, 'checkbox'), (5, 'select multiple')

questions (id, question)

answers (id, question_id, answer)

question_to_answer (question_id, answer_id, type_id)

 

don't know for certain but an abstract factory would do nice things here

hmm well what I meant was processing the form

 

here I'll give you an example of what the form looks like

 

<form name="newcatalog" id="newcatalog" action="" class="forms" method="post">
<h2>Question 1</h2>
<li> <label for="title">Question<em>*</em></label>
<input type="text" name="title" id="title" class="text" />
</li>
<div id="multiple_categories">
	<li> <label for="multiple image categories">Multiple Image Categories</label>
	<input type="checkbox" name="categories" id="categories" />
	</li>
	<li id="add-categories" style="display:none"> <label for="multiple image categories">Add Categories</label>
		<ul id="browser" class="filetree">
			<?php
				display_categories();
			?>
		</ul>
	</li>
	<li id="categories-added" style="display:none"><label for="Categories Added">Categories Added</label>
	<select id="all_categories" name="all_categories" multiple="multiple" height="5">
	</select>
	</li>
</div>					
<li> <label for="Create Drop-Down">Create Drop-Down</label>
<input type="checkbox" name="dropdown" id="dropdown" />
</li>
        <li> <label for="Add value">Add value</label>
<input type="text" name="addToDropdown" id="addToDropdown" /><a href="#"><img src="images/add.gif"></a>
        <select name="dd_values" id="dd_values">
        </select>
</li>
<li><label for="submit"></label>
<button name="add" id="add">Add another question</button><input class="submit" type="submit" value="Create catalog"/>
</li>
</form>

 

For now when a user adds a category it goes in all_categories for him to see and when he adds an option for the drop down it goes in dd_values. I need to be able to collect all of that information for several questions (depending on how many questions were added)

So how should I collect all that information?

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.