PK

ADDRLIN : /home/anibklip/aaravpest.in/
FLL :
Current File : //home/anibklip/aaravpest.in/add_masters.php

<?php 
include "templatic/head.php"; 
include "templatic/header.php";

if($_POST[sbmt_btn]){
	$fields=" master set 
		typ='$_POST[typ]', 
		val='$_POST[value]' 
	";

	if($_GET[master_id]){
		$sql="update $fields where master_id='$_GET[master_id]' ";
		$msg="Record updated Sucessfully";
	}else{
		$sql="INSERT INTO $fields ";
		$msg="Record Added Sucessfully";
	}
	mysql_query($sql) or die('error in head');
}

$q="SELECT * FROM master where master_id='$_GET[master_id]' ";
$q=mysql_query($q) or die(mysql_error());
if($editrow=mysql_fetch_array($q)){
}

?>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form ){

  // ** START **
  if (form.headname.value == "") {
    alert( "Please enter Company Name here." );
    form.headname.focus();
    return false ;
  }
  // ** END **

  // ** START **
  if (form.headperson.value == "") {
    alert( "Please enter Address." );
    form.headperson.focus();
    return false ;
  }
  // ** END **
  
  // ** START **
  if (form.headaddress.value == "") {
    alert( "Please enter Address." );
    form.headaddress.focus();
    return false ;
  }
  // ** END **
  
  return true ;
}
//-->
</script>
</head>
 <br/>

<?php
if($msg){
	?>
	<h2 id="icon_pick"><?php echo $msg?></h2> 
	<?php
}
?>
<form action="" method="post" onsubmit="return checkform(this);">
	<table cellspacing="3" align="center" width="100%" border="0" cellpadding="3">
		<tr>
			<td valign="top"><strong>Type</strong>:</td>
			<td>
				<select id="typ" name="typ" required>
					<option value="">Select Type</option>
					<option <?php echo ($editrow[typ]=="chemical"?"selected":"")?> value="chemical">Chemical (Fumigant)</option>
					<option <?php echo ($editrow[typ]=="duration"?"selected":"")?> value="duration">Duration of Exposure</option>
					<option <?php echo ($editrow[typ]=="dosage"?"selected":"")?> value="dosage">Dosage</option>
				</select>
			</td>
		</tr>
		<tr>
			<td valign="top"><strong>Value</strong>:</td>
			<td><input type="text" required name="value" id="value" value="<?php echo $editrow[val]?>" size="33" /></td>
		</tr>
		<tr>
			<td align="center" colspan="2">
				<br><input type="submit" name="sbmt_btn" value="<?php echo ($_GET[master_id]?"Update":"Add")?> Value"  class="amo-submit" />
			</td>
		</tr>
	</table>
</form>
<?php
	include "templatic/footer.php";
?>


PK 99