Page 1 of 1
How to design this concept
Posted: Fri Jul 03, 2009 11:23 am
by gimpact
Hi,
I want to learn how to design a page based on data stored in the database.
Description:
I want my user to enter 'yes' or 'no' for every option. I am going to store their response in a database. Based on the data in the database i am going to design my page. Lets say, 5 options are given to an user. The user gives 'yes' to 3 and 'no' to 2 options. When my page loads it checks for 'yes/no' in the database. For all the field marked as 'yes' gets displayed.
What is more concerning to me is, how do i design a theme page, in which the options will be aligned.
Any help will be appreciated, I am totally new. so kindly ignore my poor knowledge in designing.
Thank you
Re: How to design this concept
Posted: Sat Jul 04, 2009 3:37 am
by Jammerious
Can you be more specific about what do you need help for?
It seems pretty trivial...
Code: Select all
<?php
foreach($results as $result){
if($result['show']==1){
?>
<div id='field'>blabla</div>
<?php
}
}
?>
(check out the syntax I'm still getting used to php)
Re: How to design this concept
Posted: Sat Jul 04, 2009 9:34 am
by gimpact
Thanking you replying.
Here is what i am looking for.
Consider, I have a site, where people can make online question paper and let other user write the exam. In a question paper, there could be multiple choice question, one word answer question, True or False question, Chose the correct option question and many other...
Now, an examiner is going to design a question paper. He decides that in his exam there will be only True or False question and Chose the correct option question. He then enters 7 questions in the both section.
I am wondering how to design the exam page where, depending up on the user choice of question the page gets loaded.
One thing that just came into my mind while typing this is that. May be I will create a table and for every type of question I will have "yes" or "no" value. In the first page, i will make the examiner select the type of question he wishes to have. Provide him with a link to go to the next page. Within this time, I will enter into my database "yes" or "no" in the table. That is "yes" for the selected type of question and "no" for the unselected type. Following this, I am going to write a script which will read the table and depending up on the value available in the table i will load Theme pages which will display his 7 question. For example if he choses only True or False question, then one theme page. If he choses a combination of another type then another theme page will load and so on.
so I will have following pages
chose_your_question/php
oneword_question.php (when only oneword type of question is selected)
true_false_question.php (when only this type of question is selected)
oneword_and_true_false_question.php (when a combination of one word and true/false question is selected)
Please correct me if I am wrong in my logic.
Thank you.
Re: How to design this concept
Posted: Sat Jul 04, 2009 11:35 am
by Jammerious
Hm this is a bit confusing but still. First you should do the data model, to determine how are you going to keep the records in the database.
I would do this something like this:

(don't mind the attribute types, mind the relationships)
By question type you could determine what kind of question is this.
Like 'checkbox' would query the DB and return the question and construct the html for the form. The correct answer is marked with 'iscorrect' (set at 1, or 0 for incorrect).
For 'radiobox' the same procedure applies.
For 'textfield' entries you should just save the correct answers in the DB - anything else the users enter is wrong.
Also note you are going to need to elaborate the "users take exam" use case. (The table 'answer' above is not for the users answers.)
And, lookup "moodle" and their wiki, you might get some ideas about how to make things better.
