<?php $PageSecurity = 11;
include('includes/SQL_CommonFunctions.inc');
if(isset($_POST['submit']))
{		
	

						$sql = "INSERT Dealer SET
						`dealer_name`       ='".$_POST['short_name']."',
						`dealer_short_name`	='".$_POST['delershot']."', 
						`dealer_code`	    ='".$_POST['code']."',  
						`branch`	        ='".$_POST['Site']."',  
						`store`	            ='".$_POST['ZoneId']."',
						`area_code`	        ='".$_POST['area_code']."',
						`subarea_code`	    ='".$_POST['subarea_code']."',
						`engineer_code`	    ='".$_POST['engineer_code']."',
						`tin_no`	        ='".$_POST['tinno']."',
						`pan_no`	        ='".$_POST['panno']."',
						`margin_factor`	    ='".$_POST['marginfac']."',
						`party_code`	    ='".$_POST['partycode']."',
						`range`	            ='".$_POST['range']."',
						`pre_address1`	   ='".$_POST['pre_address1']."',
						`pin_no`	       ='".$_POST['pre_address1']."',
						`pre_country`	   ='".$_POST['pre_country']."',  
						`pre_mobile`	   ='".$_POST['pre_mobile']."',
						`pre_state`		   ='".$_POST['pre_state']."', 
						`pre_city`		   ='".$_POST['pre_city']."', 
						`pre_pincode`	   ='".$_POST['pre_pincode']."',
						`per_email`        ='".$_POST['per_email']."',
						`pre_phone1`	   ='".$_POST['pre_phone1']."',
						`CompanyId`		   ='".$_POST['CompanyName']."'";						
						
						$res = DB_query($sql,$db,$ErrMsg,$DbgMsg);
					  	$lastid=DB_Last_Insert_ID($db,'Dealer', 'id');
						

	
						
						

					for($CR=1;$CR<$_REQUEST['cnt'];$CR++)
					{
						 $insert_contact="Insert into dealer_contact_information_master set
												id='', 
												master_code='".$lastid."',  
												master_prefix='D',  
												person ='".$_REQUEST['person'][$CR]."', 
												designation='".$_REQUEST['designation'][$CR]."',  
												phone='".$_REQUEST['phone'][$CR]."',
												email='".$_REQUEST['contact_email'][$CR]."' ";	
						                        $insert_res=DB_query($insert_contact,$db);			
					}	
					//echo "<pre>";
					//print_r($insert_contact);	 exit;
 $s->pageLocation('index.php?route=Storetype1&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].'');
}
?>
<style type="text/css">
.mandatory{
 color:#FF0000;
}
</style>
<script>
function validation(form)
{
	

if(document.getElementById('c_name').value=='')
{alert('Name should not be empty');
document.getElementById('c_name').focus();
return false;
}/*
	
if(document.getElementById('short_name').value==''){
alert('Short name should not be empty');
document.getElementById('short_name').focus();
return false;
}
	

if(document.getElementById('ccategory').value==''){
alert('Category should not be empty');
document.getElementById('ccategory').focus();
return false;}
	
*/
if(document.getElementById('pre_address1').value==''){
alert('Address should not be empty');
document.getElementById('pre_address1').focus();
return false;
}
	if(document.getElementById('pre_city').value==''){
alert('Select your city');
document.getElementById('pre_city').focus();
return false;
}
	
if(document.getElementById('pre_country').value==''){
alert('Select your country');
document.getElementById('pre_country').focus();
return false;
}
	
if(document.getElementById('pre_state').value==''){
alert('Select your state');
document.getElementById('pre_state').focus();
return false;
}


if(document.getElementById('pre_pincode').value==''){
alert('Pin code should not be empty');
document.getElementById('pre_pincode').focus();
return false;
}
	
if(isNaN(document.getElementById('pre_pincode').value)){
alert('Pin Code number should be numberic');
document.getElementById('pre_pincode').focus();
return false;
}
	
if(document.getElementById('pre_phone1').value =="")
{
alert('Phone number should not be empty');
document.getElementById('pre_phone1').focus();
return false;
}
if(isNaN(document.getElementById('pre_phone1').value)){
alert('Phone number should be numberic');
document.getElementById('pre_phone1').focus();
return false;
}
	

if(document.getElementById('tin_no').value =="")
{
alert('Tin number should not be empty');
document.getElementById('tin_no').focus();
return false;
}
if(isNaN(document.getElementById('tin_no').value)){
alert('Tin number should be numberic');
document.getElementById('tin_no').focus();
return false;
}
	
if(document.getElementById('person_1').value=='' && document.getElementById('person_2').value=='' && document.getElementById('person_3').value=='')
{
alert('Please enter atleast one contact person');
document.getElementById('person_1').focus();
return false;
}

/*if(document.getElementById('pre_mobile').value==''){
alert('Mobile number should not be empty');
document.getElementById('pre_mobile').focus();
return false;
}
*/	
/*if(isNaN(document.getElementById('pre_mobile').value)){
alert('Mobile number should be numberic');
document.getElementById('pre_mobile').focus();
return false;
}
*/	
/*if(document.getElementById('per_email').value==''){
alert('Email Id should not be empty');
document.getElementById('per_email').focus();
return false;
}
*/		
return true;
}	

function search_state(str)
{
	//alert(str);
if (str.length==0)
  {
  document.getElementById("searchstate").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("searchstate").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_state.php?country="+str,true);
xmlhttp.send();
}

 
function showItems(str)
{
	if(str=="")
  {
  document.getElementById("itemid").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("itemid").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_category.php?partName="+str,true);
xmlhttp.send();
}
</script>

<style type="text/css">
    .cap{
    text-transform:uppercase
    };
	</style>
<?php 
if($_GET['action']=='editRec')
{
$SQL =  "select * from storetype Where id='".$_GET['id']."' "; 
$result = DB_query($SQL,$db,$ErrMsg);
$row = DB_fetch_assoc($result);
//echo "<pre>";
//print_r($row);

$c_name	= $row['c_name'];
$short_name= $row['short_name'];
$ccategory= $row['ccategory'];
$tax=$row['tax'];
$payment_terms=$row['payment_terms'];
$ledger_id=$row['ledger_id'];
$code= $row['client_code'];
$pre_address1= $row['pre_address1'];
$pre_address2= $row['pre_address2'];
$pre_address3= $row['pre_address3'];
$pre_area= $row['pre_area'];
$pre_country=  $s->GetFieldValue('city_master',"id='".$row['pre_city']."'" ,'country');  
$pre_state=  $s->GetFieldValue('city_master',"id='".$row['pre_city']."'" ,'state');
$pre_city= $row['pre_city'];
$pre_pincode= $row['pre_pincode'];
$pre_ext= $row['Extension'];
$pre_phone1= $row['pre_phone1'];
$pre_phone2= $row['pre_phone2'];
$pre_fax= $row['fax'];
$pre_mobile= $row['pre_mobile'];
$per_email= $row['per_email'];
$lst_no= $row['lst_no'];
$cst_no= $row['cst_no'];
$excies_no= $row['excies_no'];
$company_req_date= $row['company_req_date'];
$pan_no= $row['pan_no'];
$tin_no= $row['tin_no'];
$cl_division =$row['cl_division'];
$cl_range =$row['cl_range'];
$assigned_items =$row['assigned_items'];
$Site=$row['Site'];
$Zone=$row['Zone'];

}
else
{
$c_name	= $_REQUEST['c_name'];
$short_name= $_REQUEST['short_name'];
$ccategory= $_REQUEST['ccategory'];
$tax= $_REQUEST['tax'];
$payment_terms= $_REQUEST['payment_terms'];
$ledger_id=$_REQUEST['ledger_id'];
$code= $_REQUEST['code'];
$pre_address1= $_REQUEST['pre_address1'];
$pre_address2= $_REQUEST['pre_address2'];
$pre_address3= $_REQUEST['pre_address3'];
$pre_area= $_REQUEST['pre_area'];
$pre_country= $_REQUEST['pre_country'];
$pre_state= $_REQUEST['pre_state'];
$pre_city= $_REQUEST['pre_city'];
$pre_pincode= $_REQUEST['pre_pincode'];
$pre_ext= $_REQUEST['pre_ext'];
$pre_phone1= $_REQUEST['pre_phone1'];
$pre_phone2= $_REQUEST['pre_phone2'];
$pre_fax= $_REQUEST['pre_fax'];
$pre_mobile= $_REQUEST['pre_mobile'];
$per_email= $_REQUEST['per_email'];
$lst_no= $_REQUEST['lst_no'];
$cst_no= $_REQUEST['cst_no'];
$excies_no= $_REQUEST['excies_no'];
$pan_no= $_REQUEST['pan_no'];
$tin_no= $_REQUEST['tin_no'];
$cl_division =$_REQUEST['cl_division'];
$cl_range =$_REQUEST['cl_range'];

for($m=1;$m<$_REQUEST['cnt'];$m++)
{
		$person=$_REQUEST['person'][$m];
		$designation=$_REQUEST['designation'][$m];	
		$phone=$_REQUEST['phone'][$m];	
		$contact_email=$_REQUEST['email'][$m];
}
}
?>
<form  enctype="multipart/form-data" method="post" action="" onsubmit="return validation(this.form);">
<input type="hidden" name="id" value="<?php if(isset($row['id'])) echo $row['id']; ?>" />
  <table width="90%" border="1" align="center" style="margin-top:50px;" cellpadding="3" cellspacing="3">
    <tr>
      <td style="text-align:center; border-bottom:1px solid #cccccc; padding:2px 0px 2px 0px; border-top:1px solid #cccccc;" colspan="4" ><div align="center"><strong><font color="black" size="2">DEALER INFORMATION</font></strong></div></td>
    </tr>
    <tr>
      <th width="14%"><span class="mandatory"><strong>*</strong></span><strong>Company</strong></th>
      <td width="34%">
	  <select name="CompanyName" id="CompanyName" style="width:100%">
			<option value="0">--Select--</option>
			<?php
			$CompanyName=DB_query("Select * from companies where 1=1",$db);
			while($CompanyRow=DB_fetch_array($CompanyName))
			{ ?>
			<option value="<?php echo $CompanyRow['CompanyId']?>"<?php echo ($CompanyName1 == $CompanyRow['CompanyId']?'selected':'');?>><?php echo $CompanyRow['CompanyName']?></option>	
				
		<?php	}
			
			   
			?>
	  </select>      </td>
      <th width="14%"><strong>Dealer Name </strong></th>
      <td width="38%"><input name="short_name" type="text" class="cap" id="short_name" value='<?php if(isset($short_name)) echo $short_name; ?>'  style="width:100%"/></td>
    </tr>
    <tr>
      <th><strong> Short Name </strong></th>
      <td>
	  <input type="delershot" id="delershort" style="width:100%"  />		</td>  
	  <th><strong>Dealer Code</strong></th>
      <td>	 
  	 <input name="code" type="text" id="code" value="" style="width:100%" readonly="true"  onkeyup="showdealercode()"/></td>
   </tr>
   <tr>
   	<th><span class="mandatory"><strong>*</strong></span><strong>Branch</strong></th>
   	<td><select name="Site"  onclick="ShowDiv(this.value,'hid-zone-div','getSite.php?type=Companyusers')" style="width:100%">
    	
    	<option value="0">--Select--</option>
			<?php
			$SiteName=DB_query("Select * from locations  where mst_companyid='".$_SESSION['ACGCompanyId']."'",$db);
			while($SiteRow=DB_fetch_array($SiteName))
			{ ?>
			<option value="<?php echo $SiteRow['loccode']?>"  <?php echo($Site==$SiteRow['loccode']?'selected':'');?>  ><?php echo $SiteRow['locationname']?></option>	
				
		<?php	}
			
			   
			?>
	  </select></td>
   	<th><span class="mandatory"><strong>*</strong></span><strong>Store</strong></th>
   	<td><div id='hid-zone-div'>
   		<select name="ZoneId" style="width:100%" multiple="multiple">
    	
    	<option value="0">--Select--</option>
			<?php
			$ZoneName=DB_query("SELECT DISTINCT ZoneTitle,id FROM zone_master",$db);
			while($ZoneRow=DB_fetch_array($ZoneName))
			{ ?>
			<option value="<?php echo $ZoneRow['id']?>"<?php echo($Zone==$ZoneRow['id']?'selected':'');?>><?php echo $ZoneRow['ZoneTitle']?></option>	
				
		<?php	}
			
			   
			?>
		</select></div>   	</td>
   	</tr>
	<tr>
	<th><span class="mandatory"><strong>*</strong></span><strong>Sub Area Code</strong></th>
   	<td><input type="text" name="subarea_code" id="subarea_code" style="width:100%" /></td>
   	<th><span class="mandatory"><strong>*</strong></span><strong>Area Code</strong></th>
   	<td><select name="areacode" id="areacode" style="width:100%">
	    <option value="">Select</option>
		<?php 
		$sql=DB_query("select * from zone_master where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
		while($row1=DB_fetch_array($sql))
		{
		?>
		<option value="<?php echo $row1['id']; ?>"><?php echo $row1['ZoneTitle']; ?></option>
		
	<?php } ?>
	</select>
	</td>
   	
   	</tr>
	<tr>
   	<th><span class="mandatory"><strong>*</strong></span><strong>Engineer Code</strong></th>
   	<td><input type="text" name="engineer_code" id="engineer_code"  style="width:100%" /></td>
   	<td></td>
   	<td></td>
   	</tr>
	
    <tr>
        <td style="text-align:center; border-bottom:1px solid #cccccc; padding:2px 0px 2px 0px; border-top:1px solid #cccccc;" colspan="4" ><div align="center"><strong><font color="black" size="2">DEALER</font><font color="black" size="2"> ADDRESS</font></strong></div></td>
<!--	  <td colspan="5" align="center"><div align="center"><font color="black" size="4">CLIENT ADDRESS </font></div></td>
-->    </tr>
    <tr>
      <th rowspan="3"><p><strong><span class="mandatory">*</span> Address </strong></p></th>
      <td rowspan="3">
	  	  <textarea  name="pre_address1" id="pre_address1"  cols="20" rows="3" style="width:100%"><?php if(isset($pre_address1)) echo $pre_address1; ?></textarea>	   </td>
      <td><span class="mandatory"><strong>*</strong></span><strong> Pin Code</strong></td>
      <td><input type="text" id="pre_pincode" name="pre_pincode" value='<?php if(isset($pre_pincode)) echo $pre_pincode; ?>' style="width:100%"></td>
    </tr>
    
    <tr>
      <td><span class="mandatory"><strong>*</strong></span><strong> Phone </strong></td>
      <td><input type="text" id="pre_phone1"   name="pre_phone1" value='<?php if(isset($pre_phone1)) echo $pre_phone1; ?>' style="width:100%" /></td>
    </tr>
    <tr>
      <td><span class="mandatory"><strong>*</strong></span><strong> City </strong></td>
      <td colspan="2">
	   <select name="pre_city" id="pre_city" style="width:100%" onchange="ShowDiv(this.value,'searchstate','get_state.php?type=client')" >
       <option value="">---Select City---</option>
	   <?php 
	   $sql = "select * from city_master where 1=1";
	   $result = DB_query($sql,$db);
	   while($city_row = DB_fetch_array($result))
	   {
	   		$p='';
			if($city_row['id'] == $pre_city)
			$p="selected";
	   ?>
	  <option value="<?php echo $city_row['id']; ?>" <?php echo ($pre_city==$city_row['id']?"selected":"") ?>><?php echo $city_row['city']; ?></option>
	   <?php }?>
      </select>	  </td>
    </tr>
	
	
    <tr>
      <td colspan="2" rowspan="2"><div id="searchstate">
	  
	  <table width="100%" border="0" cellspacing="2" cellpadding="0">
  <tr>
    <td width="29%"><strong>State</strong></td>
    <td width="71%">
 
	<select name="pre_state" id="pre_state" style="width:100%" onchange="search_city(this.value)">
 	   <?php 
	    $sql = "select * from state_master where id = '".$pre_state."' ";
		$result=DB_query($sql,$db);
		while($myrow=DB_fetch_array($result))
		{ 
			$p='';
			if($myrow['id'] == $pre_state)
			$p="selected";
		?>
		<option value="<?php echo $myrow['id'];?>" <?php echo ($row['pre_state']==$myrow['id']?"selected":"") ?>><?php echo $myrow['state']; ?></option>
		<?php }
	   ?>
      </select></td>
  </tr>
  <tr>
    <td><strong>Country</strong></td>
    <td>
	 
	<select name="pre_country" id="pre_country" style="width:100%"  >
          <option value="">---Select Country---</option>
        <?php 
			$c_sql = "select * from country_master where id='".$pre_country."'";
			$c_result = DB_query($c_sql,$db);
			while($c_row=DB_fetch_array($c_result))
			{
				$p='';
				if($c_row['id']==$pre_country)
				$p= "selected";
			?>
				<option value="<?php echo $c_row['id']; ?>"<?php echo ($pre_country==$c_row['id']?"selected":"") ?>><?php echo $c_row['country']; ?></option>
	  <?php }
		?>
		</select></td>
  </tr>
</table>
	  </div>�</td>
      <td><strong> Mobile</strong></td>
      <td><input type="text" id="pre_mobile" name="pre_mobile" style="width:100%" value='<?php if(isset($pre_mobile)) echo $pre_mobile; ?>' /></td>
    </tr>
	
    <tr>
      <td><strong> Email Id</strong></td>
      <td><input type="text" id="per_email" name="per_email" style="width:100%" value='<?php if(isset($per_email)) echo $per_email; ?>'></td>
    </tr>
	  
	
	 <tr>
      <td style="text-align:center; border-bottom:1px solid #cccccc; padding:2px 0px 2px 0px; border-top:1px solid #cccccc;" colspan="4" ><div align="center"><strong><font color="black" size="2">OTHER INFORMATION</font></strong></div></td>
    </tr>
    <tr>
      <th width="14%"><span class="mandatory"><strong>*</strong></span><strong>Tin No </strong></th>
      <td width="34%"><input name="tinno" type="delershot" id="tinno" style="width:100%"></td>
      <th width="14%"><strong>Pan No </strong></th>
      <td width="38%"><input name="panno" type="text" class="cap" id="panno" value=''  style="width:100%"/></td>
    </tr>
    <tr>
      <th><strong> Margin Factor </strong></th>
      <td>
	  <input type="marginfac" id="marginfac" style="width:100%"  />		</td>  
	  <th><strong>Party Code</strong></th>
      <td>	 
  	 <input name="partycode" type="text" id="partycode" value="" style="width:100%" /></td>
   </tr>
   <tr>
   	<th><span class="mandatory"><strong>*</strong></span><strong>Range</strong></th>
   	<td><input name="range" type="text" id="range" value="" style="width:100%" readonly="true"  /></td>
   	<td>&nbsp;</td>
   	<td>&nbsp;</td>
   </tr>
    <tr>
	  <td style="text-align:center; border-bottom:1px solid #cccccc; padding:2px 0px 2px 0px; border-top:1px solid #cccccc;" colspan="4" ><div align="center"><strong><font color="black" size="2">CONTACT INFORMATION </font></strong></div></td>
<!--	  <td colspan="5" align="center"><div align="center"><font color="black" size="4">CONTACT PERSON </font></div></td>
-->    </tr>
<tr>    
<td colspan="4">    
<table width="100%" cellpadding="3">	
<?php
if($_REQUEST['action']=='editRec')
{
  $contact_sql="Select * from contact_information_master where master_code='".$row['id']."'";
$contact_res=DB_query($contact_sql,$db);
	$k=1;
	while($contact_row=DB_fetch_array($contact_res))
	{
		$id[$k]=$contact_row['id'];
		$row_id[$k]=$contact_row['id'];
	  	$person[$k]=$contact_row['person'];
		$designation[$k]=$contact_row['designation'];	
		$phone[$k]=$contact_row['phone'];	
		$contact_email[$k]=$contact_row['email'];
		?>
	<tr>
      <td><strong>Contact Person <?php echo $k;?> </strong></td>
      <td><input type="text" name="person[<?php echo $k;?>]" class="cap" id="person_<?php echo $k;?>" value="<?php echo $person[$k];?>" size="40"  />
	  <input type="hidden" name="row_id[<?php echo $k;?>]" value="<?php echo $contact_row['id'];?>" /></td>
      <td><strong>Designation</strong></td>
      <td><input type="text" name="designation[<?php echo $k;?>]" class="cap" id="designation_<?php echo $k;?>" value="<?php echo $designation[$k];?>"  /></td>
	  <td><strong>Phone/Mobile</strong></td>
	  <td><input type="text" name="phone[<?php echo $k;?>]" id="phone_<?php echo $k;?>" value="<?php echo $phone[$k];?>" size="15" class="cap" /></td>
	  <td><strong>Email Id </strong></td>
	  <td><input type="text" name="contact_email[<?php echo $k;?>]" id="contact_email_<?php echo $k;?>" value="<?php echo $contact_email[$k];?>" class="cap" /></td>
    </tr>
 		<?php 
 	$k++;
	}?>
	
	<tr>
      <td><strong>Contact Person <?php echo $k;?> </strong></td>
      <td><input type="text" name="person[<?php echo $k;?>]" class="cap" id="person_<?php echo $k;?>" value="<?php echo $person[$k];?>" size="40"  />
	  <input type="hidden" name="row_id[<?php echo $k;?>]" value="<?php echo $contact_row['id'];?>" /></td>
      <td><strong>Designation</strong></td>
      <td><input type="text" name="designation[<?php echo $k;?>]" class="cap" id="designation_<?php echo $k;?>" value="<?php echo $designation[$k];?>"  /></td>
	  <td><strong>Phone/Mobile</strong></td>
	  <td><input type="text" name="phone[<?php echo $k;?>]" id="phone_<?php echo $k;?>" value="<?php echo $phone[$k];?>" size="15" class="cap" /></td>
	  <td><strong>Email Id </strong></td>
	  <td><input type="text" name="contact_email[<?php echo $k;?>]" id="contact_email_<?php echo $k;?>" value="<?php echo $contact_email[$k];?>" class="cap" /></td>
    </tr>
	
	<?php 
 }
  else{
 
 for($j=1;$j<4;$j++)
{?>
	<tr>
      <td><strong>Contact Person <?php echo $j;?> </strong></td>
      <td><input type="text" name="person[<?php echo $j;?>]" class="cap" id="person_<?php echo $j;?>" value="<?php echo $person[$j];?>" size="40"  />
	  <input type="hidden" name="row_id[<?php echo $j;?>]" value="<?php echo $id[$j];?>" /></td>
      <td><strong>Designation</strong></td>
      <td><input type="text" name="designation[<?php echo $j;?>]" class="cap" id="designation_<?php echo $j;?>" value="<?php echo $designation[$j];?>"  /></td>
	  <td><strong>Phone/Mobile</strong></td>
	  <td><input type="text" name="phone[<?php echo $j;?>]" id="phone_<?php echo $j;?>" value="<?php echo $phone[$j];?>" size="15" class="cap" /></td>
	  <td><strong>Email Id </strong></td>
	  <td><input type="text" name="contact_email[<?php echo $j;?>]" id="contact_email_<?php echo $j;?>" value="<?php echo $contact_email[$j];?>" class="cap" /></td>
    </tr>
<?php 
}
}  
 
?>



<input type="hidden" name="cnt" id="cnt" value="<?php echo $j;?>"/>
</table></td>	
</tr>	
  </table>
  
  <p>&nbsp;</p>
  <table>
  <tr><td align="center" style="text-align:center;  padding:5px 0px 5px 0px;" colspan="2" ><span style="text-align:center;">
  <?php if(isset($_GET['action'])=='editRec') { ?>
  <input type="submit" value="Update" name="update" />
  <?php }else{ ?>
  <input type="submit" value="Save" name="submit" />
  <?php } ?>
  <input name="reset" type="reset" value="Reset" />
</span></td>
  </tr><tr><td>&nbsp;</td>
  </tr></table></form>