Insert into designated table if one of the options from radio is chosen – help [on hold]

I have my register form where u can choose type of account ( for example Type1 and Type2) and if u choose type of your account then it creates an account in the designated table ( but it doesn’t work)

<div class="custom-control custom-radio">     <input type="radio" class="custom-control-input" id="customControlValidation2" name="type" value="type1" required>     <label class="custom-control-label" for="customControlValidation2">Type1</label>   </div>    <div class="custom-control custom-radio">     <input type="radio" class="custom-control-input" id="customControlValidation3" name="type" value="type2" required>     <label class="custom-control-label" for="customControlValidation3">Type2</label> 

add_new_user.php

$  type=$  _POST["type"];  if ($  type='type2') {     $  query = "INSERT INTO type2_acc VALUES(";     $  query .= "NULL, '$  name', '$  pass', '$  email')"; } if ($  type = "type1"){     $  query = "INSERT INTO type1_acc VALUES(";     $  query .= "NULL, '$  name', '$  pass', '$  email')";} 

Everytime it add account into type1_acc table, doesn’t matter if i choose type2. How change it?