<?php 

if(isset($_POST['scan_barcode'])){
    echo $userid=$_POST['userid'];
}
?>
<div class="">
    <form method="post" action="#">
        <input type="text" name="userid" >
        <input type="submit" name="scan_barcode" value="submit">
    </form>
</div>