如何使用单个提交按钮向数据库提交多个值? [英] How to submit multiple values to the database with a single submit button?

查看:59
本文介绍了如何使用单个提交按钮向数据库提交多个值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题和答案供用户提交。

我已将问题存储在问题表中。 qid,qtext。

在答案表中回答。援助,atext,cans(正确的ans)


我已经从数据库中显示了问题和多个答案。喜欢这个..


什么是印度首都

1.Chennai

2.Bangalore

3.Delhi


什么是英格兰首都

1.London

2.Paris

3.Madrid


现在用户可以为每个问题选择一个答案..

i have questions and answers for users to submit.
i have stored questions in questions table. qid, qtext.
answers in answers table. aid,atext,cans (correct ans)

i have displayed the questions and multiple answers from database. like this..

What is capital of India
1.Chennai
2.Bangalore
3.Delhi

What is capital of England
1.London
2.Paris
3.Madrid

now the user can select one answer for each question..

展开 | 选择 | Wrap | 行号

推荐答案

好吧,他们会通过选择答案来填写表格。然后他们会将表格提交给另一页。该页面将使用INSERT语句将其选择保存到数据库。
Well, they would fill out the form by selecting their answers. They would then submit their form to another page. That page would use INSERT statements to save their selections to the database.


当用户单击提交按钮时,在下一页中如何检索要存储在数据库中的值?

如何将提交按钮中的值传递到下一页?有3个问题和3个答案...

每个用户我必须在数据库中存储问题ID和他的ans id?我怎么能这样做。
when user clicks the submit button, in the next page how can i retrieve the values to store in the database?
how can i pass the values in the submit button to the next page? there are 3 questions and 3 answers...
for each user i have to to store question id and his ans id in the database? how can i do it.


这取决于你如何传递表格。如果你正在使用POST,那么你使用
That depends on how you''re passing the form. If you''re using POST then you use the


这篇关于如何使用单个提交按钮向数据库提交多个值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆