<?
	include('check_member.php');
	$bName = $_GET['bName'];
	$mId = $_SESSION['mId'];
	$morenum = $_POST['morenum'];
	
	require_once('link.php');
	mysql_select_db($database,$connect);

	$query = "SELECT * FROM `Band` WHERE `bName` ='$bName'";
	mysql_query('SET NAMES utf8');

	$result = mysql_query($query,$connect);
	$row = mysql_fetch_object($result);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>台灣樂團資料庫-樂團資料修改</title>

<style>
<!--
.style1 {font-size: 13px; color: #FFFFFF; }
BODY {
	SCROLLBAR-FACE-COLOR: #D4D0C8;
	SCROLLBAR-HIGHLIGHT-COLOR: #D4D0C8;
	SCROLLBAR-SHADOW-COLOR: #999999;
	SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
	SCROLLBAR-ARROW-COLOR:  #000000;
	SCROLLBAR-TRACK-COLOR: #E3E3E3;
	SCROLLBAR-DARKSHADOW-COLOR: #666666;
	background-color: #000000;
	background-image: url(img/bmnum.png);
	background-attachment: fixed;
}
a:link {
	color: white;
	text-decoration: none;
}
a:visited {
	color: white;
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
}
-->
</style>


</head>
<body leftmargin=0 topmargin=0 bgproperties="fixed" rightmargin=0  bottommargin=0 marginwidth=0 marginheight=0>
<div align = "center"><p>&nbsp;</p>
<a href = "b_show.php?bName=<? echo $bName;?>"><strong>返回樂團資料</strong></a>
</div>

<center>
<form action="bmodify_act.php" name="modify" method="post" enctype = "multipart/form-data">
  <table border = "0" width="444" cellpadding="1" cellspacing="0" align="center" class="style1">
	<tr bgcolor="#291830">
		<td colspan = "4"><div align="center"><? echo $row->bName; ?><br>
		(不修改的選項 請保持原本的資料不作更動)</div></td>
	</tr><tr><td colspan = "3" height = "1"></td></tr>
	<tr>
		<td width="82" bgcolor="#523659"><div align="center" >成立日期</div></td><td width="0"></td>
		<td width="354" bgcolor="#523659">
		  <div align="left">
		    <input type = "text" name = "bStartTime" value = "<? echo $row->bStartTime;?>" size="47">
        </div></td>
	</tr><tr><td colspan = "2" height = "1"></td>
	<tr>
		<td bgcolor="#7C5C7A"><div align="center">樂團簡介</div></td><td width="0"></td>
		<td bgcolor="#7C5C7A"><div align="left">
		  <textarea cols = "40" rows = "15" name="bInfo"><? echo $row->bInfo; ?></textarea>
		  </div></td>
	</tr><tr><td colspan = "3" height = "1"></td></tr>
	<tr>
		<? 
				/*$query2 = "SELECT `name`,`talent` FROM `bmember` WHERE `bName` = '$bName'";
				$result2 = mysql_query($query2,$connect);
				$num1 = mysql_num_rows($result2);
				for($i = 1;$i<=$num1;$i++)
				{
					$row2 = mysql_fetch_object($result2);
					echo $row2->name ;?>(<? echo $row2->talent ; ?>)<br>
		  <?   } */ ?>
		<td bgcolor="#7C5967"><div align="center">成員</div></td><td width="0"></td>
		<td bgcolor="#7C5967">		  <?
				$query3 = "SELECT `name`,`talent` FROM `Bmember` WHERE `bName` = '$bName'";
				$result3 = mysql_query($query3,$connect);
				$num2 = mysql_num_rows($result3);
				for($i = 1;$i<=$num2;$i++)
				{
					$row3 = mysql_fetch_object($result3);?>
				  <div align="left">
					    <input type = "text" name="name[<? echo $i;?>]" value ="<? echo $row3->name;?>" size="12">
					  (
					  <input type = "text" name="talent[<? echo $i;?>]" value ="<? echo $row3->talent; ?>" size="12">
					  )
					  <br>
		            <?  }
				if($morenum!='')
				{
					for($i=$num2+1;$i<=$num2+$morenum;$i++)
					{?>
						  <input type = "text" name="name[<? echo $i;?>]" size="12">
						  (
						  <input type = "text" name="talent[<? echo $i;?>]" size="12">
						  )
						  <br>
					      <? }
				}
			?>
		  </div></td></tr><tr><td colspan = "3" height = "1"></td></tr>
	<?
		if($row->bPhoto=="")
		{
			echo "<tr><td bgcolor='#666666'><div align='center'>樂團圖片</div></td></td><td width='1'></td>";
			echo "<input type = 'hidden' name = 'MAX_FILE_SIZE' value = '2048000'>";
			echo "<td bgcolor='#999999'><div align='center'><input type='file' name='bPhoto[0]' size = '38'></div></td></tr><tr><td colspan = '2' height = '1'></td>";
		}
	?>		
	<tr bgcolor="#836D6C">
		<td colspan = "4"><div align = "center">
		  <input type = "hidden" name = "bName" value = <? echo $bName;?>>
			<input type = "hidden" name = "mId" value = "<? echo $mId;?>">
			<input type = "submit" value = "修改完畢">
        </div></td>
	</tr>
</table>
</form>
</center>
</body>
</html>
