I am trying to update one of two tables within my DB, based upon the results of a variable. Essentially, the variable is either "a" or "b", based upon the form selection. I define this variable as $t. I have defined the other variables as well. Here is the code:
$t = $_POST['t']; //(defined in javascript from form selection)
$a = "a";
$b = "b";
//Create own rows in table based upon $t type
if ($t = $a){
$sql = "INSERT INTO user_a (id, email, user_type, name, create_time)
VALUES ('$db_id','$e','$a','$n', now())";
$query = mysqli_query($db_conx, $sql);
} else {
$sql = "INSERT INTO user_b (id, email, user_type, name, create_time)
VALUES ('$db_id','$e','$b','$n', now())";
$query = mysqli_query($db_conx, $sql);
exit();
}
I have some coding before this, however I don't think that is the issue, as I can update both tables. I can only update table "a", and not table "b". Appreciate the help.