Forum Moderators: open
Min
We would need a little bit more info to help you out properly, but here's an example:
Example form:
<form action="test.cfm" method="post">
<input type="text" name="Field1" /><br />
<input type="text" name="Field2" /><br />
<input type="text" name="Field3" /><br />
<input type="text" name="Field4" /><br />
<input type="text" name="Field5" /><br />
<input type="submit" value="Send" />
</form>
Example test.cfm:
<cfquery name="insert1" datasource="mydb" dbtype="ODBC">
INSERT INTO table1
(id, col1, col2)
VALUES
(#Field1#, '#Field2#', '#Field3#')
</cfquery>
<cfquery name="insert2" datasource="mydb" dbtype="ODBC">
INSERT INTO table2
(id, col1, col2)
VALUES
(#Field1#, '#Field4#', '#Field5#')
</cfquery>
If you could provide us with more specific info like your form code and basic database schema, I'm sure we could help you out.
mavherick
TT
TestTypeID
Type
Online (check Box)
Each type of test has many questions
TQ
TestQuestioID
Question
Type
Each question has many choices(options) A,B, C, D etc
TC
TestChoiceID
Choice_Letter
Choice_text
questionToChoice
TA
TestAnswerID
AnswerToChoice
Explaination
I wish to create a form where the admin of the online test can input all the data...OR my second alternative is to have multiple forms like the codes below
Code to input data into TestType table
<FORM ACTION="addtesttype2.cfm" METHOD="post">
Module Number : <input type="text" name="type" size="20"></p>
<p>Online? : <input type="checkbox" name="online" value="ON"></p>
<p> <input type="submit" value="Submit">
<input type="reset" value="Reset"></p>
</form>
addtesttype2.cfm
<CFINSERT DATASOURCE="mcaikni2" TABLENAME="table_testtype">
<HTML>
<HEAD>
<TITLE>Link Added</TITLE>
</HEAD>
<BODY>
link added
<FORM ACTION="addtestq2.cfm" Method="post">
<p> </p>
<p>Type of test <input type="text" name="type" size="20"></p>
<p>(Please input module number):</p>
<p>Question : <textarea rows="2" name="question" cols="46"></textarea></p>
<p><input type="submit" value="Submit">
<input type="reset" value="Reset"></p>
</FORM>
</BODY>
</HTML>
However, I feel that this is not good as the admin has to input by himself the type of test again ...<p>Type of test <input type="text" name="type" size="20"></p> where actually this is from the previous form....
sorry if it sounds complicated...many thanks, hope you can help.
Min
<cfoutput><input type="hidden" name="type" value="#form.type#" /></cfoutput>
instead of:
<p>Type of test <input type="text" name="type" size="20"></p>
that way you carry your type value over to your next script.
What you could also do is on the first page, add a text box with maybe the number of questions that there will be for this test and the max number of choices for a given question. that way you can simply generate the exact amount of boxes for your questions and setup everything in two pages. Let me know if your interested in an example.
mavherick
Min