<?php

function new#record#($#masterkey#=null){
	global $db;
	
	if (!isset($#masterkey#)) $#masterkey#=GETVAL('#masterkey#');
	
	header('parenttab: #master_record#_'.$#masterkey#);
	
	//gsguard if applicable
	
	$query="select * from #master_tablename# where #masterkey#=?";
	$rs=sql_prep($query,$db,$#masterkey#);
	$myrow=sql_fetch_assoc($rs);
	$#master_dispfield#=$myrow['#master_dispfield#'];
		
?>
<div class="section">
	<div class="sectiontitle"><?tr('list_#record#_add_tab');?></div>
	
	<div class="inputrow">
		<div class="formlabel"><?tr('list_#master_record#_stab');?>:</div>
		<input class="inp" readonly disabled value="<?echo htmlspecialchars($#master_dispfield#);?>">
	</div>
		
<div class="col">
#iterator-fieldlist-newrecord#
</div>
<div class="clear"></div>

		<div class="inputrow">
			<button onclick="add#record#(<?echo $#masterkey#?>,'<?emitgskey('add#record#_'.$#masterkey#);?>');"><?tr('button_#record#_add')?></button>
		</div>
</div>
<?

}