PHP transaction not rolling back

     

I am using a php transaction to insert into two tables in my database (employer and address). When I insert information into the form everything occurs as intended except no information is being inserted into the address table. I don't understand why this is happening. If there is an error that is preventing information being inserted into the table should it not rollback and throw some kind of error due to this if statement:


if(!$conn->commit()){
// rollback if commit fails   $conn->rollback();
echo "failure";   echo mysqli_error($conn);  }  

My form html is:


   Register                                               
  

and my php code is:


$user = "root";  $password = "";  $db = "database";
$conn = new mysqli("localhost" $user $password