<?php
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
mysql_selectDB("wauhaha_karaoke",$login);
$RID = $_POST["RID"];	
$roomname = $_POST["roomname"];
$roomremain = $_POST["roomremain"];
$np = $_POST["np"];
$sp = $_POST["sp"];

$a=a;
if((!is_numeric($np))||(!is_numeric($sp))){
		echo "<script language='javascript'>alert('Input Must Be Numeric.')</script>";
		echo "<script language='javascript'>window.location='addroomtype'</script>";die;
}
if(($roomname =="")||($np == "")||($sp == "")){
		echo "<script language='javascript'>alert('Please Fill In Completely.')</script>";
		echo "<script language='javascript'>window.location='addroomtype.php'</script>";

}else{


$query =mysql_query("INSERT INTO roomtype(RID,roomtype,price1,price2)VALUES('$RID','$roomname','$np','$sp')");


if($query){		
		echo "<script language='javascript'>alert('Add Room Successful.')</script>";
		echo "<script language='javascript'>window.location='roomtype.php'</script>";
		}else{
		echo "<script language='javascript'>alert('Add Room Failed.')</script>";
		echo "<script language='javascript'>window.location='roomtype.php'</script>";
		
		}
	}
	?>