Location: PHPKode > projects > Matt's March Madness > trunk/admin/bracket.php
<?php
include 'functions.php';
validatecookie();
include("header.php");

$iphone = false;
if( (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== FALSE ) || 
	(strpos($_SERVER['HTTP_USER_AGENT'], 'iPod') !== FALSE ) 
)  
{
	$iphone = true;
}  

$teams = "SELECT * FROM `master` WHERE `id`=1"; //select teams
$teams = mysql_query($teams,$db);
if(!($teams = @mysql_fetch_array($teams))) {//if fetching the array fails, prompt configuration
	echo "The bracket has not yet been released.\n";
	exit();
}

// checking to see if any POST exists eliminates an error message
if($_POST == NULL ) {
   $id = 0;
}
else if($_POST['id'] == NULL) {
	$id = 0;
}
else {
	$id = $_POST['id'];
}
if($id == 0) {
	$query = "SELECT * FROM `master` WHERE `id`=2";
	$picks = mysql_query($query,$db);
	$picks = mysql_fetch_array($picks);
}
else {
	$query = "SELECT * FROM `brackets` WHERE `id` = '$id'"; //select entry
	$picks = mysql_query($query,$db);
	$picks = mysql_fetch_array($picks);
}

if( $id!=0 ) {
	$tb = $picks['tiebreaker'];
}
else {
	$tb = $meta['tiebreaker'];
}

?>
	<div id="main">
		<div class="full">
			<?php if($id == 0) { ?>
			<h2>The Master Bracket</h2>
			<?php } else { ?>
			<h2><?=$picks['name']?>&rsquo;s Bracket</h2>
			<?php } ?>
			<h3>&nbsp;</h3>
			<form method="post" name="bracket" class="bracket" id="bracket" action="update.php?id=<?=$id?>">
				<p class="highlight"><em><strong>Please note:</strong></em> A game is not selected unless it is HIGHLIGHTED. Every time you submit this form, the master bracket will be overwritten.</p>
				<table width="700" border="1">
					<tr>
						<td colspan="5"><h1><?php echo $meta['region1']?></h1></td>
					</tr>
					<tr>
						<td>1. <?=$teams['1']?></td>
						<td rowspan="2">
							<select name="1" size="2" class="forms" id="1" onchange="update('1','33',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['1']?>" <?=($teams['1']==$picks['1'] && $picks['1']!=NULL ? "selected" : "")?>><?=$teams['1']?></option>
								<option value="<?=$teams['2']?>" <?=($teams['2']==$picks['1'] && $picks['1']!=NULL ? "selected" : "")?>><?=$teams['2']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="33" size="2" class="forms" id="33" onchange="update('33','49',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['1']?>" <?=($picks['1']==$picks['33'] && $picks['33']!=NULL ? "selected" : "")?>><?=$picks['1']?></option>
								<option value="<?=$picks['2']?>" <?=($picks['2']==$picks['33'] && $picks['33']!=NULL ? "selected" : "")?>><?=$picks['2']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="49" size="2" class="forms" id="49" onchange="update('49','57',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['33']?>" <?=($picks['33']==$picks['49'] && $picks['49']!=NULL ? "selected" : "")?>><?=$picks['33']?></option>
								<option value="<?=$picks['34']?>" <?=($picks['34']==$picks['49'] && $picks['49']!=NULL ? "selected" : "")?>><?=$picks['34']?></option>
							</select>
						</td>
						<td rowspan="16">
							<select name="57" size="2" class="forms" id="57" onchange="update('57','61',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['49']?>" <?=($picks['49']==$picks['57'] && $picks['57']!=NULL ? "selected" : "")?>><?=$picks['49']?></option>
								<option value="<?=$picks['50']?>" <?=($picks['50']==$picks['57'] && $picks['57']!=NULL ? "selected" : "")?>><?=$picks['50']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>16. <?=$teams['2']?></td>
					</tr>
					<tr>
						<td>8. <?=$teams['3']?></td>
						<td rowspan="2">
							<select name="2" size="2" class="forms" id="2" onchange="update('2','33',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['3']?>" <?=($teams['3']==$picks['2'] && $picks['2']!=NULL ? "selected" : "")?>><?=$teams['3']?></option>
								<option value="<?=$teams['4']?>" <?=($teams['4']==$picks['2'] && $picks['2']!=NULL ? "selected" : "")?>><?=$teams['4']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>9. <?=$teams['4']?></td>
					</tr>
					<tr>
						<td>5. <?=$teams['5']?></td>
						<td rowspan="2">
							<select name="3" size="2" class="forms" id="3" onchange="update('3','34',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['5']?>" <?=($teams['5']==$picks['3'] && $picks['3']!=NULL ? "selected" : "")?>><?=$teams['5']?></option>
								<option value="<?=$teams['6']?>" <?=($teams['6']==$picks['3'] && $picks['3']!=NULL ? "selected" : "")?>><?=$teams['6']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="34" size="2" class="forms" id="34" onchange="update('34','49',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['3']?>" <?=($picks['3']==$picks['34'] && $picks['34']!=NULL ? "selected" : "")?>><?=$picks['3']?></option>
								<option value="<?=$picks['4']?>" <?=($picks['4']==$picks['34'] && $picks['34']!=NULL ? "selected" : "")?>><?=$picks['4']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>12. <?=$teams['6']?></td>
					</tr>
					<tr>
						<td>4. <?=$teams['7']?></td>
						<td rowspan="2">
							<select name="4" size="2" class="forms" id="4" onchange="update('4','34',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['7']?>" <?=($teams['7']==$picks['4'] && $picks['4']!=NULL ? "selected" : "")?>><?=$teams['7']?></option>
								<option value="<?=$teams['8']?>" <?=($teams['8']==$picks['4'] && $picks['4']!=NULL ? "selected" : "")?>><?=$teams['8']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>13. <?=$teams['8']?></td>
					</tr>
					<tr>
						<td>6. <?=$teams['9']?></td>
						<td rowspan="2">
							<select name="5" size="2" class="forms" id="5" onchange="update('5','35',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['9']?>" <?=($teams['9']==$picks['5'] && $picks['5']!=NULL ? "selected" : "")?>><?=$teams['9']?></option>
								<option value="<?=$teams['10']?>" <?=($teams['10']==$picks['5'] && $picks['5']!=NULL ? "selected" : "")?>><?=$teams['10']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="35" size="2" class="forms" id="35" onchange="update('35','50',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['5']?>" <?=($picks['5']==$picks['35'] && $picks['35']!=NULL ? "selected" : "")?>><?=$picks['5']?></option>
								<option value="<?=$picks['6']?>" <?=($picks['6']==$picks['35'] && $picks['35']!=NULL ? "selected" : "")?>><?=$picks['6']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="50" size="2" class="forms" id="50" onchange="update('50','57',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['35']?>" <?=($picks['35']==$picks['50'] && $picks['50']!=NULL ? "selected" : "")?>><?=$picks['35']?></option>
								<option value="<?=$picks['36']?>" <?=($picks['36']==$picks['50'] && $picks['50']!=NULL ? "selected" : "")?>><?=$picks['36']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>11. <?=$teams['10']?></td>
					</tr>
					<tr>
						<td>3. <?=$teams['11']?></td>
						<td rowspan="2">
							<select name="6" size="2" class="forms" id="6" onchange="update('6','35',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['11']?>" <?=($teams['11']==$picks['6'] && $picks['6']!=NULL ? "selected" : "")?>><?=$teams['11']?></option>
								<option value="<?=$teams['12']?>" <?=($teams['12']==$picks['6'] && $picks['6']!=NULL ? "selected" : "")?>><?=$teams['12']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>14. <?=$teams['12']?></td>
					</tr>
					<tr>
						<td>7. <?=$teams['13']?></td>
						<td rowspan="2">
							<select name="7" size="2" class="forms" id="7" onchange="update('7','36',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['13']?>" <?=($teams['13']==$picks['7'] && $picks['7']!=NULL ? "selected" : "")?>><?=$teams['13']?></option>
								<option value="<?=$teams['14']?>" <?=($teams['14']==$picks['7'] && $picks['7']!=NULL ? "selected" : "")?>><?=$teams['14']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="36" size="2" class="forms" id="36" onchange="update('36','50',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['7']?>" <?=($picks['7']==$picks['36'] && $picks['36']!=NULL ? "selected" : "")?>><?=$picks['7']?></option>
								<option value="<?=$picks['8']?>" <?=($picks['8']==$picks['36'] && $picks['36']!=NULL ? "selected" : "")?>><?=$picks['8']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>10. <?=$teams['14']?></td>
					</tr>
					<tr>
						<td>2. <?=$teams['15']?></td>
						<td rowspan="2">
							<select name="8" size="2" class="forms" id="8" onchange="update('8','36',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['15']?>" <?=($teams['15']==$picks['8'] && $picks['8']!=NULL ? "selected" : "")?>><?=$teams['15']?></option>
								<option value="<?=$teams['16']?>" <?=($teams['16']==$picks['8'] && $picks['8']!=NULL ? "selected" : "")?>><?=$teams['16']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>15. <?=$teams['16']?></td>
					</tr>
				</table>
				<table width="700" border="1">
					<tr>
						<td colspan="5"><h1><?php echo $meta['region2']?></h1></td>
					</tr>
					<tr>
						<td>1. <?=$teams['17']?></td>
						<td rowspan="2">
							<select name="9" class="forms" size="2" id="9" onchange="update('9','37',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['17']?>" <?=($teams['17']==$picks['9'] && $picks['9']!=NULL ? "selected" : "")?>><?=$teams['17']?></option>
								<option value="<?=$teams['18']?>" <?=($teams['18']==$picks['9'] && $picks['9']!=NULL ? "selected" : "")?>><?=$teams['18']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="37" class="forms" size="2" id="37" onchange="update('37','51',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['9']?>" <?=($picks['9']==$picks['37'] && $picks['37']!=NULL ? "selected" : "")?>><?=$picks['9']?></option>
								<option value="<?=$picks['10']?>" <?=($picks['10']==$picks['37'] && $picks['37']!=NULL ? "selected" : "")?>><?=$picks['10']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="51" class="forms" size="2" id="51" onchange="update('51','58',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['37']?>" <?=($picks['37']==$picks['51'] && $picks['51']!=NULL ? "selected" : "")?>><?=$picks['37']?></option>
								<option value="<?=$picks['38']?>" <?=($picks['38']==$picks['51'] && $picks['51']!=NULL ? "selected" : "")?>><?=$picks['38']?></option>
							</select>
						</td>
						<td rowspan="16">
							<select name="58" class="forms" size="2" id="58" onchange="update('58','61',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['51']?>" <?=($picks['51']==$picks['58'] && $picks['58']!=NULL ? "selected" : "")?>><?=$picks['51']?></option>
								<option value="<?=$picks['52']?>" <?=($picks['52']==$picks['58'] && $picks['58']!=NULL ? "selected" : "")?>><?=$picks['52']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>16. <?=$teams['18']?></td>
					</tr>
					<tr>
						<td>8. <?=$teams['19']?></td>
						<td rowspan="2">
							<select name="10" class="forms" size="2" id="10" onchange="update('10','37',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['19']?>" <?=($teams['19']==$picks['10'] && $picks['10']!=NULL ? "selected" : "")?>><?=$teams['19']?></option>
								<option value="<?=$teams['20']?>" <?=($teams['20']==$picks['10'] && $picks['10']!=NULL ? "selected" : "")?>><?=$teams['20']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>9. <?=$teams['20']?></td>
					</tr>
					<tr>
						<td>5. <?=$teams['21']?></td>
						<td rowspan="2">
							<select name="11" class="forms" size="2" id="11" onchange="update('11','38',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['21']?>" <?=($teams['21']==$picks['11'] && $picks['11']!=NULL ? "selected" : "")?>><?=$teams['21']?></option>
								<option value="<?=$teams['22']?>" <?=($teams['22']==$picks['11'] && $picks['11']!=NULL ? "selected" : "")?>><?=$teams['22']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="38" class="forms" size="2" id="38" onchange="update('38','51',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['11']?>" <?=($picks['11']==$picks['38'] && $picks['38']!=NULL ? "selected" : "")?>><?=$picks['11']?></option>
								<option value="<?=$picks['12']?>" <?=($picks['12']==$picks['38'] && $picks['38']!=NULL ? "selected" : "")?>><?=$picks['12']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>12. <?=$teams['22']?></td>
					</tr>
					<tr>
						<td>4. <?=$teams['23']?></td>
						<td rowspan="2">
							<select name="12" class="forms" size="2" id="12" onchange="update('12','38',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['23']?>" <?=($teams['23']==$picks['12'] && $picks['12']!=NULL ? "selected" : "")?>><?=$teams['23']?></option>
								<option value="<?=$teams['24']?>" <?=($teams['24']==$picks['12'] && $picks['12']!=NULL ? "selected" : "")?>><?=$teams['24']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>13. <?=$teams['24']?></td>
					</tr>
					<tr>
						<td>6. <?=$teams['25']?></td>
						<td rowspan="2">
							<select name="13" class="forms"  size="2"id="13" onchange="update('13','39',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['25']?>" <?=($teams['25']==$picks['13'] && $picks['13']!=NULL ? "selected" : "")?>><?=$teams['25']?></option>
								<option value="<?=$teams['26']?>" <?=($teams['26']==$picks['13'] && $picks['13']!=NULL ? "selected" : "")?>><?=$teams['26']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="39" class="forms"  size="2"id="39" onchange="update('39','52',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['13']?>" <?=($picks['13']==$picks['39'] && $picks['39']!=NULL ? "selected" : "")?>><?=$picks['13']?></option>
								<option value="<?=$picks['14']?>" <?=($picks['14']==$picks['39'] && $picks['39']!=NULL ? "selected" : "")?>><?=$picks['14']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="52" class="forms"  size="2" id="52" onchange="update('52','58',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['39']?>" <?=($picks['39']==$picks['52'] && $picks['52']!=NULL ? "selected" : "")?>><?=$picks['39']?></option>
								<option value="<?=$picks['40']?>" <?=($picks['40']==$picks['52'] && $picks['52']!=NULL ? "selected" : "")?>><?=$picks['40']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>11. <?=$teams['26']?></td>
					</tr>
					<tr>
						<td>3. <?=$teams['27']?></td>
						<td rowspan="2">
							<select name="14" size="2" class="forms" id="14" onchange="update('14','39',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['27']?>" <?=($teams['27']==$picks['14'] && $picks['14']!=NULL ? "selected" : "")?>><?=$teams['27']?></option>
								<option value="<?=$teams['28']?>" <?=($teams['28']==$picks['14'] && $picks['14']!=NULL ? "selected" : "")?>><?=$teams['28']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>14. <?=$teams['28']?></td>
					</tr>
					<tr>
						<td>7. <?=$teams['29']?></td>
						<td rowspan="2">
							<select name="15" class="forms" size="2" id="15" onchange="update('15','40',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['29']?>" <?=($teams['29']==$picks['15'] && $picks['15']!=NULL ? "selected" : "")?>><?=$teams['29']?></option>
								<option value="<?=$teams['30']?>" <?=($teams['30']==$picks['15'] && $picks['15']!=NULL ? "selected" : "")?>><?=$teams['30']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="40" class="forms" size="2" id="40" onchange="update('40','52',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['15']?>" <?=($picks['15']==$picks['40'] && $picks['40']!=NULL ? "selected" : "")?>><?=$picks['15']?></option>
								<option value="<?=$picks['16']?>" <?=($picks['16']==$picks['40'] && $picks['40']!=NULL ? "selected" : "")?>><?=$picks['16']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>10. <?=$teams['30']?></td>
					</tr>
					<tr>
						<td>2. <?=$teams['31']?></td>
						<td rowspan="2">
							<select name="16" class="forms" size="2" id="16" onchange="update('16','40',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['31']?>" <?=($teams['31']==$picks['16'] && $picks['16']!=NULL ? "selected" : "")?>><?=$teams['31']?></option>
								<option value="<?=$teams['32']?>" <?=($teams['32']==$picks['16'] && $picks['16']!=NULL ? "selected" : "")?>><?=$teams['32']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>15. <?=$teams['32']?></td>
					</tr>
				</table>
				<table width="700" border="1">
					<tr>
						<td colspan="5"><h1><?php echo $meta['region3']?></h1></td>
					</tr>
					<tr>
						<td>1. <?=$teams['33']?></td>
						<td rowspan="2">
							<select name="17" class="forms" size="2" id="17" onchange="update('17','41',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['33']?>" <?=($teams['33']==$picks['17'] && $picks['17']!=NULL ? "selected" : "")?>><?=$teams['33']?></option>
								<option value="<?=$teams['34']?>" <?=($teams['34']==$picks['17'] && $picks['17']!=NULL ? "selected" : "")?>><?=$teams['34']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="41" class="forms" size="2" id="41" onchange="update('41','53',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['17']?>" <?=($picks['17']==$picks['41'] && $picks['41']!=NULL ? "selected" : "")?>><?=$picks['17']?></option>
								<option value="<?=$picks['18']?>" <?=($picks['18']==$picks['41'] && $picks['41']!=NULL ? "selected" : "")?>><?=$picks['18']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="53" class="forms" size="2" id="53" onchange="update('53','59',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['41']?>" <?=($picks['41']==$picks['53'] && $picks['53']!=NULL ? "selected" : "")?>><?=$picks['41']?></option>
								<option value="<?=$picks['42']?>" <?=($picks['42']==$picks['53'] && $picks['53']!=NULL ? "selected" : "")?>><?=$picks['42']?></option>
							</select>
						</td>
						<td rowspan="16">
							<select name="59" class="forms" size="2" id="59" onchange="update('59','62',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['53']?>" <?=($picks['53']==$picks['59'] && $picks['59']!=NULL ? "selected" : "")?>><?=$picks['53']?></option>
								<option value="<?=$picks['54']?>" <?=($picks['54']==$picks['59'] && $picks['59']!=NULL ? "selected" : "")?>><?=$picks['54']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>16. <?=$teams['34']?></td>
					</tr>
					<tr>
						<td>8. <?=$teams['35']?></td>
						<td rowspan="2">
							<select name="18" size="2" class="forms" id="18" onchange="update('18','41',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['35']?>" <?=($teams['35']==$picks['18'] && $picks['18']!=NULL ? "selected" : "")?>><?=$teams['35']?></option>
								<option value="<?=$teams['36']?>" <?=($teams['36']==$picks['18'] && $picks['18']!=NULL ? "selected" : "")?>><?=$teams['36']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>9. <?=$teams['36']?></td>
					</tr>
					<tr>
						<td>5. <?=$teams['37']?></td>
						<td rowspan="2">
							<select name="19" size="2" class="forms" id="19" onchange="update('19','42',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['37']?>" <?=($teams['37']==$picks['19'] && $picks['19']!=NULL ? "selected" : "")?>><?=$teams['37']?></option>
								<option value="<?=$teams['38']?>" <?=($teams['38']==$picks['19'] && $picks['19']!=NULL ? "selected" : "")?>><?=$teams['38']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="42" size="2" class="forms" id="42" onchange="update('42','53',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['19']?>" <?=($picks['19']==$picks['42'] && $picks['42']!=NULL ? "selected" : "")?>><?=$picks['19']?></option>
								<option value="<?=$picks['20']?>" <?=($picks['20']==$picks['42'] && $picks['42']!=NULL ? "selected" : "")?>><?=$picks['20']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>12. <?=$teams['38']?></td>
					</tr>
					<tr>
						<td>4. <?=$teams['39']?></td>
						<td rowspan="2">
							<select name="20" size="2" class="forms" id="20" onchange="update('20','42',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['39']?>" <?=($teams['39']==$picks['20'] && $picks['20']!=NULL ? "selected" : "")?>><?=$teams['39']?></option>
								<option value="<?=$teams['40']?>" <?=($teams['40']==$picks['20'] && $picks['20']!=NULL ? "selected" : "")?>><?=$teams['40']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>13. <?=$teams['40']?></td>
					</tr>
					<tr>
						<td>6. <?=$teams['41']?></td>
						<td rowspan="2">
							<select name="21" size="2" class="forms" id="21" onchange="update('21','43',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['41']?>" <?=($teams['41']==$picks['21'] && $picks['21']!=NULL ? "selected" : "")?>><?=$teams['41']?></option>
								<option value="<?=$teams['42']?>" <?=($teams['42']==$picks['21'] && $picks['21']!=NULL ? "selected" : "")?>><?=$teams['42']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="43" class="forms" size="2" id="43" onchange="update('43','54',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['21']?>" <?=($picks['21']==$picks['43'] && $picks['43']!=NULL ? "selected" : "")?>><?=$picks['21']?></option>
								<option value="<?=$picks['22']?>" <?=($picks['22']==$picks['43'] && $picks['43']!=NULL ? "selected" : "")?>><?=$picks['22']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="54" class="forms" size="2" id="54" onchange="update('54','59',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['43']?>" <?=($picks['43']==$picks['54'] && $picks['54']!=NULL ? "selected" : "")?>><?=$picks['43']?></option>
								<option value="<?=$picks['44']?>" <?=($picks['44']==$picks['54'] && $picks['54']!=NULL ? "selected" : "")?>><?=$picks['44']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>11. <?=$teams['42']?></td>
					</tr>
					<tr>
						<td>3. <?=$teams['43']?></td>
						<td rowspan="2">
							<select name="22" class="forms" size="2" id="22" onchange="update('22','43',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['43']?>" <?=($teams['43']==$picks['22'] && $picks['22']!=NULL ? "selected" : "")?>><?=$teams['43']?></option>
								<option value="<?=$teams['44']?>" <?=($teams['44']==$picks['22'] && $picks['22']!=NULL ? "selected" : "")?>><?=$teams['44']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>14. <?=$teams['44']?></td>
					</tr>
					<tr>
						<td>7. <?=$teams['45']?></td>
						<td rowspan="2">
							<select name="23" class="forms" size="2" id="23" onchange="update('23','44',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['45']?>" <?=($teams['45']==$picks['23'] && $picks['23']!=NULL ? "selected" : "")?>><?=$teams['45']?></option>
								<option value="<?=$teams['46']?>" <?=($teams['46']==$picks['23'] && $picks['23']!=NULL ? "selected" : "")?>><?=$teams['46']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="44" class="forms" size="2" id="44" onchange="update('44','54',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['23']?>" <?=($picks['23']==$picks['44'] && $picks['44']!=NULL ? "selected" : "")?>><?=$picks['23']?></option>
								<option value="<?=$picks['24']?>" <?=($picks['24']==$picks['44'] && $picks['44']!=NULL ? "selected" : "")?>><?=$picks['24']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>10. <?=$teams['46']?></td>
					</tr>
					<tr>
						<td>2. <?=$teams['47']?></td>
						<td rowspan="2">
							<select name="24" class="forms" size="2" id="24" onchange="update('24','44',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['47']?>" <?=($teams['47']==$picks['24'] && $picks['24']!=NULL ? "selected" : "")?>><?=$teams['47']?></option>
								<option value="<?=$teams['48']?>" <?=($teams['48']==$picks['24'] && $picks['24']!=NULL ? "selected" : "")?>><?=$teams['48']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>15. <?=$teams['48']?></td>
					</tr>
				</table>
				<table width="700" border="1">
					<tr>
						<td colspan="5"><h1><?php echo $meta['region4']?></h1></td>
					</tr>
					<tr>
						<td>1. <?=$teams['49']?></td>
						<td rowspan="2">
							<select name="25" class="forms" size="2" id="25" onchange="update('25','45',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['49']?>" <?=($teams['49']==$picks['25'] && $picks['25']!=NULL ? "selected" : "")?>><?=$teams['49']?></option>
								<option value="<?=$teams['50']?>" <?=($teams['50']==$picks['25'] && $picks['25']!=NULL ? "selected" : "")?>><?=$teams['50']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="45" class="forms" size="2" id="45" onchange="update('45','55',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['25']?>" <?=($picks['25']==$picks['45'] && $picks['45']!=NULL ? "selected" : "")?>><?=$picks['25']?></option>
								<option value="<?=$picks['26']?>" <?=($picks['26']==$picks['45'] && $picks['45']!=NULL ? "selected" : "")?>><?=$picks['26']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="55" class="forms" size="2" id="55" onchange="update('55','60',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['45']?>" <?=($picks['45']==$picks['55'] && $picks['55']!=NULL ? "selected" : "")?>><?=$picks['45']?></option>
								<option value="<?=$picks['46']?>" <?=($picks['46']==$picks['55'] && $picks['55']!=NULL ? "selected" : "")?>><?=$picks['46']?></option>
							</select>
						</td>
						<td rowspan="16">
							<select name="60" class="forms" size="2" id="60" onchange="update('60','62',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['55']?>" <?=($picks['55']==$picks['60'] && $picks['60']!=NULL ? "selected" : "")?>><?=$picks['55']?></option>
								<option value="<?=$picks['56']?>" <?=($picks['56']==$picks['60'] && $picks['60']!=NULL ? "selected" : "")?>><?=$picks['56']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>16. <?=$teams['50']?></td>
					</tr>
					<tr>
						<td>8. <?=$teams['51']?></td>
						<td rowspan="2">
							<select name="26" class="forms" size="2" id="26" onchange="update('26','45',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['51']?>" <?=($teams['51']==$picks['26'] && $picks['26']!=NULL ? "selected" : "")?>><?=$teams['51']?></option>
								<option value="<?=$teams['52']?>" <?=($teams['52']==$picks['26'] && $picks['26']!=NULL ? "selected" : "")?>><?=$teams['52']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>9. <?=$teams['52']?></td>
					</tr>
					<tr>
						<td>5. <?=$teams['53']?></td>
						<td rowspan="2">
							<select name="27" class="forms" size="2" id="27" onchange="update('27','46',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['53']?>" <?=($teams['53']==$picks['27'] && $picks['27']!=NULL ? "selected" : "")?>><?=$teams['53']?></option>
								<option value="<?=$teams['54']?>" <?=($teams['54']==$picks['27'] && $picks['27']!=NULL ? "selected" : "")?>><?=$teams['54']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="46" class="forms" size="2" id="46" onchange="update('46','55',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['27']?>" <?=($picks['27']==$picks['46'] && $picks['46']!=NULL ? "selected" : "")?>><?=$picks['27']?></option>
								<option value="<?=$picks['28']?>" <?=($picks['28']==$picks['46'] && $picks['46']!=NULL ? "selected" : "")?>><?=$picks['28']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>12. <?=$teams['54']?></td>
					</tr>
					<tr>
						<td>4. <?=$teams['55']?></td>
						<td rowspan="2">
							<select name="28" class="forms" size="2" id="28" onchange="update('28','46',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['55']?>" <?=($teams['55']==$picks['28'] && $picks['28']!=NULL ? "selected" : "")?>><?=$teams['55']?></option>
								<option value="<?=$teams['56']?>" <?=($teams['56']==$picks['28'] && $picks['28']!=NULL ? "selected" : "")?>><?=$teams['56']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>13. <?=$teams['56']?></td>
					</tr>
					<tr>
						<td>6. <?=$teams['57']?></td>
						<td rowspan="2">
							<select name="29" class="forms" size="2" id="29" onchange="update('29','47',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['57']?>" <?=($teams['57']==$picks['29'] && $picks['29']!=NULL ? "selected" : "")?>><?=$teams['57']?></option>
								<option value="<?=$teams['58']?>" <?=($teams['58']==$picks['29'] && $picks['29']!=NULL ? "selected" : "")?>><?=$teams['58']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="47" class="forms" size="2" id="47" onchange="update('47','56',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['29']?>" <?=($picks['29']==$picks['47'] && $picks['47']!=NULL ? "selected" : "")?>><?=$picks['29']?></option>
								<option value="<?=$picks['30']?>" <?=($picks['30']==$picks['47'] && $picks['47']!=NULL ? "selected" : "")?>><?=$picks['30']?></option>
							</select>
						</td>
						<td rowspan="8">
							<select name="56" class="forms" size="2" id="56" onchange="update('56','60',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['47']?>" <?=($picks['47']==$picks['56'] && $picks['56']!=NULL ? "selected" : "")?>><?=$picks['47']?></option>
								<option value="<?=$picks['48']?>" <?=($picks['48']==$picks['56'] && $picks['56']!=NULL ? "selected" : "")?>><?=$picks['48']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>11. <?=$teams['58']?></td>
					</tr>
					<tr>
						<td>3. <?=$teams['59']?></td>
						<td rowspan="2">
							<select name="30" class="forms" size="2" id="30" onchange="update('30','47',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['59']?>" <?=($teams['59']==$picks['30'] && $picks['30']!=NULL ? "selected" : "")?>><?=$teams['59']?></option>
								<option value="<?=$teams['60']?>" <?=($teams['60']==$picks['30'] && $picks['30']!=NULL ? "selected" : "")?>><?=$teams['60']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>14. <?=$teams['60']?></td>
					</tr>
					<tr>
						<td>7. <?=$teams['61']?></td>
						<td rowspan="2">
							<select name="31" class="forms" size="2" id="31" onchange="update('31','48',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['61']?>" <?=($teams['61']==$picks['31'] && $picks['31']!=NULL ? "selected" : "")?>><?=$teams['61']?></option>
								<option value="<?=$teams['62']?>" <?=($teams['62']==$picks['31'] && $picks['31']!=NULL ? "selected" : "")?>><?=$teams['62']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="48" class="forms" size="2" id="48" onchange="update('48','56',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['31']?>" <?=($picks['31']==$picks['48'] && $picks['48']!=NULL ? "selected" : "")?>><?=$picks['31']?></option>
								<option value="<?=$picks['32']?>" <?=($picks['32']==$picks['48'] && $picks['48']!=NULL ? "selected" : "")?>><?=$picks['32']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>10. <?=$teams['62']?></td>
					</tr>
					<tr>
						<td>2. <?=$teams['63']?></td>
						<td rowspan="2">
							<select name="32" class="forms" size="2" id="32" onchange="update('32','48',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$teams['63']?>" <?=($teams['63']==$picks['32'] && $picks['32']!=NULL ? "selected" : "")?>><?=$teams['63']?></option>
								<option value="<?=$teams['64']?>" <?=($teams['64']==$picks['32'] && $picks['32']!=NULL ? "selected" : "")?>><?=$teams['64']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td>15. <?=$teams['64']?></td>
					</tr>
				</table>
				<br />
				<table width="700" border="1">
					<tr>
						<td colspan="3"><h1 align="center">FINAL FOUR</h1></td>
					</tr>
					<tr>
						<td><?php echo $meta['region1']?> Champion</td>
						<td rowspan="2">
							<select name="61" size="2" class="forms" id="61" onchange="update('61','63',0);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['57']?>" <?=($picks['57']==$picks['61'] && $picks['61']!=NULL ? "selected" : "")?>><?=$picks['57']?></option>
								<option value="<?=$picks['58']?>" <?=($picks['58']==$picks['61'] && $picks['61']!=NULL ? "selected" : "")?>><?=$picks['58']?></option>
							</select>
						</td>
						<td rowspan="4">
							<select name="63" size="2" class="forms" id="63">
								<option value="<?=$picks['61']?>" <?=($picks['61']==$picks['63'] && $picks['63']!=NULL ? "selected" : "")?>><?=$picks['61']?></option>
								<option value="<?=$picks['62']?>" <?=($picks['62']==$picks['63'] && $picks['63']!=NULL ? "selected" : "")?>><?=$picks['62']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td><?php echo $meta['region2']?> Champion</td>
					</tr>
					<tr>
						<td><?php echo $meta['region3']?> Champion</td>
						<td rowspan="2">
							<select name="62" size="2" class="forms" id="62" onchange="update('62','63',1);">
								<?php if( $iphone ) { ?><option value=""></option><?php } ?>								
								<option value="<?=$picks['59']?>" <?=($picks['59']==$picks['62'] && $picks['62']!=NULL ? "selected" : "")?>><?=$picks['59']?></option>
								<option value="<?=$picks['60']?>" <?=($picks['60']==$picks['62'] && $picks['62']!=NULL ? "selected" : "")?>><?=$picks['60']?></option>
							</select>
						</td>
					</tr>
					<tr>
						<td><?php echo $meta['region4']?> Champion</td>
					</tr>
				</table>
					<div align="center">
					<p>Tiebreaker <input type="text" name="tiebreaker" value="<?=$picks['tiebreaker']?>" size="10" maxlength="3" /></p>
					<p><input type="submit" name="Submit" value="Submit" /></p>
					</div>
				</p>
			</form>
		</div>
	</div>
	<div id="footer"> </div>
</div>
</body>
</html>
Return current item: Matt's March Madness