<?php

$host="localhost"; // Host name 
$username="mrbs"; // Mysql username 
$passwordw="mrbs-password"; // Mysql password 
$db_name="mrbs"; // Database name 
$tbl_name="mrbs_users"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$passwordw")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// Get values from form 
$name=$_POST['nama'];
$password=$_POST['password'];
$level=$_POST['level'];

// Insert data into mysql 
$sql="INSERT INTO $tbl_name(name, password, level)VALUES('$name', '$password', '$level')";
$result=mysql_query($sql);

// if successfully insert data into database, displays message "Successful". 
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='daftar.php'>Back to main page</a>";
}

else {
echo "ERROR";
}
?> 

<?php 
// close connection 
mysql_close();
?>