<?php
$login=mysql_connect('localhost', 'wauhaha_karaoke', 'cross123','wauhaha_karaoke');
	
	mysql_selectDB("wauhaha_karaoke",$login);
	
$roomtype = $_POST["type"];
$roomq = $_POST["roomq"];

$a = $_POST["status"];
$result = mysql_query("select RoomNo from room");
$row = mysql_fetch_array($result);
$RoomID = $row['RoomID'];

if(($roomq =="")){
		echo "<script language='javascript'>alert('Please Fill In Completely.')</script>";
		echo "<script language='javascript'>window.location='addroomtype.php'</script>";

}else{
for($b=1;$b<=$roomq;$b ++){

$query =mysql_query("INSERT INTO room(roomtype,status)VALUES('$roomtype','$a')");

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