[英]how to send data to different tables in mysql database using one form
Im creating a college management system . 我正在建立大学管理制度。 So depending on the department and level registered by the student to should go to the required table . 因此,根据学生注册的部门和级别,应转到所需的表。 I have 9 tables; 我有9张桌子; 3 business administration table for three levels ie 100level ,200level, 300level 3个业务管理表,分为三个级别,即100级,200级,300级
3 Pharmacy table for three levels ie 100level ,200level, 300level 3个药房表,分为三个级别,即100级,200级,300级
3 Computer science table for three levels ie 100level ,200level, 300level 3三个级别的计算机科学表,即100级,200级,300级
You should try something before posting question. 在发布问题之前,您应该先尝试一下。 You could probably try this logic: 您可能可以尝试以下逻辑:
If pharmacy is selected and particular level is selected then in your PHP script, 如果选择了药房并且选择了特定级别,则在PHP脚本中,
<?php
if(isset($_POST['pharmacy']) && $_POST['level']=='100'){
$data = // Place your data here...
$table_name = 'pharmacy_100';
}
else if(isset($_POST['pharmacy']) && $_POST['level']=='200'){
$data = // Place your data here...
$table_name = 'pharmacy_200';
}
else if(isset($_POST['pharmacy']) && $_POST['level']=='300'){
$data = // Place your data here...
$table_name = 'pharmacy_300';
}
// Same for all 3 branches...
?>
Now, you will have $data
variable ready to store in database. 现在,您将可以将$data
变量准备存储在数据库中。 By means of SQL connection you can add it in database. 通过SQL连接,您可以将其添加到数据库中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.