Ok.. Try this code by replacing insert statement.. It surely works..
$sql="INSERT INTO register(name,username,pass1,pass2,email,number)VALUES ('$name','$username','$pass1','$pass2','$email','$number')";
and additionally use exit; after echo statement in else part. This will automatically terminates the execution if condition not satisfied. Because, we should not use any output command before calling header() function..
Hope you can understand and solve your issue. If still probs, please let me know..
by Ezzaral: Added code tags. Please use them to format any code that you post.