[英]how to insert same data in different table based on checkbox ? mysql php
I want to insert data in multiple table我想在多个表中插入数据
I have two tables > recharge, due_user我有两张表 > 充值,due_user
recharge table has充值表有
>> ID - MOBno- AMount - Network
due_user has由于_用户有
>> ID - userID - MOBno - Amount - NETWORK
in my form I have checkbox which will ask userID only if I click checkbox.在我的表单中,我有复选框,只有当我单击复选框时才会询问用户 ID。
now insertion of data procedure would be .现在插入数据过程将是。
if unchecked如果未选中
data > ID - mobno - Amount- Network
will be inserted in Recharging table if checked如果选中,将插入充电表
data > ID- userID - mobile - amount - Network
will go both table Recharge and Due_user table but user id will we goes into only due usertable将同时进入表 Recharge 和 Due_user 表,但用户 id 我们将只进入到期的用户表
Let's say your checkbox looks like this假设您的复选框看起来像这样
<input type="checkbox" name="isUserId" />
Then in php然后在 php
<?php
//here goes your recharge table insert
if(isset($_POST['isUserId'])){
//and here due user table insert
}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.