使用复选框的html表单查询

时间:2013-03-01 19:00:08

标签: php mysql phpmyadmin

我正在开发phpmysql中的癌症风险评估工具。用户需要从包含复选框的html表单中选择风险和症状,然后根据存储在数据库中的内容检查选项。这是表格。 html form to asses cancer risk

以下是存储在mysql数据库中的数据的屏幕截图,其中将检查提交的复选框。

oesophageal_carcinoma_riskfactors_tbl riskfactors

oesophageal_carcinoma_symptoms_tbl symptoms

oesophageal_carcinoma_riskfactors_tbl response: table containing response the user should get after submiting the html form with checkboxes

如果有人在这里检查了html

enter image description here

查询提取的响应应来自响应表中的responseID = 1。

我的表如何链接外键,以及PHP代码如何查询数据库。

1 个答案:

答案 0 :(得分:0)

尼克,当你说你需要一个“关系”表时,你的评论是正确的。我建议创建一个具有自己的主键的表和另外3个作为外键服务的列。 E.g:

|id|risk_id|symptom_id|response_id|
___________________________________
| 1|    2  |   3      |     4     |

对于好的度量索引外键列。

相关问题