Please attach the .php page so I can open it in Dreamweaver instead of using copy/paste in the future.
I see your recordset uses $_SESSION['UserID'] and your insert uses $_POST["userid"]
That may be the issue.
Also you are validating the value of:
$totalRows_duplicatecheck
but with MySQLi the syntax should be:
$duplicatecheck->TotalRows
I think everything else looks correct.