Jump to content

MySql/PHP/Checkbox Problem !


etdsbastar

Recommended Posts

Hello there,

 

I don't know what's wrong with the below given code. Trying from the past 2 days. Please Please help me. Again and again the form is refreshing and the data is not saving in the table. I think there's a problem with checkbox and secondly, the SQL statement. Please help me...

 

<?php
function renderform($entyear, $demandno, $censusno, $name, $caste, $address, $mobile, $colony, $houseno, $wardno, $nv1, $nv2, $nv3, $nv4, $nv5, $nv6, $resmainroad, $indmainroad, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $e1, $e2, $e3, $e4, $e5, $e6, $e7, $f1, $f2, $f3, $f4, $f5, $f6, $f7, $totalplotarea, $totaldevarea, $totalplotopenarea, $buildingyear, $concessiontype, $watertype, $watercardno, $waterledgerno, $anugya, $landtype, $checkdate)
{ 
	include_once '../header.php';
	include_once '../config/config.php';
	include_once '../functions/functions.php';
	extract($GLOBALS);

$resultward = mysql_query("SELECT * FROM wards order by wardno") 
				or die(mysql_error()); 
?>

<link rel=stylesheet HREF="/css/sp.css" type="text/css" media="screen">
<div id="content">
	<div id="labelopt"><div class="box"></div> jax ds lHkh dkWye vfuok;Z gSa A  'kwU; ls Hkjs gq;s fdlh Hkh dkWye dks [kkyh ugha NksM+sa] vxj dksbZ izfo"Bh ugha gks rks 0 M+kysa A</div>
	<div id="labelopt"></div>
	<h2>u;s losZ{k.k QkeZ dk la;kstu</h2>
	<div id="dp-sp">
	<form name="spnewform" action="" method="post" onsubmit="return ValidateFormSPNew()">
		<table>
			<tr>
				<td id="labelmust">fMek.M dzekad %</td>
				<td><input class="english" type="text" size="20%" name="demandno" maxlength="40" value="<?php echo $demandno; ?>" />
				<td id="labelopt">tux.kuk dzekad %</td>
				<td><input class="hindi" type="text" size="15%" name="censusno" maxlength="30" value="<?php echo $censusno; ?>"/>
				<td id="labelmust">o"kZ %</td>
				<td colspan="3"><input class="english" type="text" size="8%" name="entyear" maxlength="4" value="<?php echo $entyear; ?>"/>
			</tr>
			<tr>
				<td id="labelmust">laifRr ds Lokeh dk uke %</td>
				<td colspan="3"><input class="hindi" type="text" size="40%" name="name" maxlength="100" value="<?php echo $name; ?>"/>
				<td id="labelopt">tkfr %</td>
				<td><input class="hindi" type="text" size="10" name="caste" maxlength="50" value="<?php echo $caste; ?>"/>
			</tr>
			<tr>
				<td id="labelopt">laifRr ds Lokeh dk irk %</td>
				<td colspan="3"><textarea id="styledAddress" name="youraddress"><?php echo $address; ?></textarea>
				<td id="labelopt">IykV @ edku dzekad %</td>
				<td><input class="english" type="text" size="10" name="houseno" maxlength="40" value="<?php echo $houseno; ?>"/>
			</tr>
			<tr>
				<td id="labelopt">eksgYyk %</td>
				<td><textarea id="styledColony" name="colony"><?php echo $colony; ?></textarea>
				<td id="labelmust">okMZ dzekad %</td>
				<td>
					<select name="wardno" id="wardno">
						<?php
						while($rowward = mysql_fetch_array( $resultward )) {
							echo "\n<option value='".$rowward['wardno']."'>".$rowward['wardno']."</option>";
						}
						echo "\n";
						?>
					</select>				
				</td>
				<td id="labelopt" colspan="2">okMZ dk uke Lor% gh vk;sxk] dzekad p;u djsa A</td>
			</tr>

			<tr></tr><tr></tr>

			<tr><td id="labelopt" colspan="3">fufeZr {ks= ds orZeku mi;ksx dh tkudkjh %</td></tr>
		</table>
			<tr>
				<table width="98%" border="1px" cellspacing="0" cellpadding="2">
				<tr>
					<th rowspan="2">fufeZr {ks= dk izdkj</th>
					<th colspan="3">vkoklh;</th>
					<th colspan="3">O;kolkf;d@vkS|ksfxd</th>
				</tr>
				<tr>
					<th>fuekZ.k oxZ 01</th>
					<th>fuekZ.k oxZ 02</th>
					<th>fuekZ.k oxZ 03</th>
					<th>fuekZ.k oxZ 01</th>
					<th>fuekZ.k oxZ 02</th>
					<th>fuekZ.k oxZ 03</th>
				</tr>
				<tr>
					<th align="right">Hkou dk izdkj %</th>
					<th><input type="checkbox" name="nv1" value = "<?php echo $nv1; ?>" <?php if($nv1=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
					<th><input type="checkbox" name="nv2" value = "<?php echo $nv2; ?>" <?php if($nv2=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
					<th><input type="checkbox" name="nv3" value = "<?php echo $nv3; ?>" <?php if($nv3=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
					<th><input type="checkbox" name="nv4" value = "<?php echo $nv4; ?>" <?php if($nv4=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
					<th><input type="checkbox" name="nv5" value = "<?php echo $nv5; ?>" <?php if($nv5=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
					<th><input type="checkbox" name="nv6" value = "<?php echo $nv6; ?>" <?php if($nv6=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
				</tr>
				<tr>
					<th align="left">Hkwry</th>
					<td align="center"><input class="english" type="text" size="10" name="a1" maxlength="10" value="<?php echo $a1; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="b1" maxlength="10" value="<?php echo $b1; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="c1" maxlength="10" value="<?php echo $c1; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="d1" maxlength="10" value="<?php echo $d1; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="e1" maxlength="10" value="<?php echo $e1; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="f1" maxlength="10" value="<?php echo $f1; ?>" />
				</tr>
				<tr>
					<th align="left">izFke ry</th>
					<td align="center"><input class="english" type="text" size="10" name="a2" maxlength="10" value="<?php echo $a2; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="b2" maxlength="10" value="<?php echo $b2; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="c2" maxlength="10" value="<?php echo $c2; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="d2" maxlength="10" value="<?php echo $d2; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="e2" maxlength="10" value="<?php echo $e2; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="f2" maxlength="10" value="<?php echo $f2; ?>"" />
				</tr>
				<tr>
					<th align="left">f}rh; ry</th>
					<td align="center"><input class="english" type="text" size="10" name="a3" maxlength="10" value="<?php echo $a3; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="b3" maxlength="10" value="<?php echo $b3; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="c3" maxlength="10" value="<?php echo $c3; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="d3" maxlength="10" value="<?php echo $d3; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="e3" maxlength="10" value="<?php echo $e3; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="f3" maxlength="10" value="<?php echo $f3; ?>" />
				</tr>
				<tr>
					<th align="left">r`rh; ry ls mij</th>
					<td align="center"><input class="english" type="text" size="10" name="a4" maxlength="10" value="<?php echo $a4; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="b4" maxlength="10" value="<?php echo $b4; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="c4" maxlength="10" value="<?php echo $c4; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="d4" maxlength="10" value="<?php echo $d4; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="e4" maxlength="10" value="<?php echo $e4; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="f4" maxlength="10" value="<?php echo $f4; ?>" />
				</tr>
				<tr>
					<th align="left">Hkwfexr</th>
					<td align="center"><input class="english" type="text" size="10" name="a5" maxlength="10" value="<?php echo $a5; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="b5" maxlength="10" value="<?php echo $b5; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="c5" maxlength="10" value="<?php echo $c5; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="d5" maxlength="10" value="<?php echo $d5; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="e5" maxlength="10" value="<?php echo $e5; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="f5" maxlength="10" value="<?php echo $f5; ?>" />
				</tr>
				<tr>
					<th align="left">dqy</th>
					<td align="center"><input class="englishlocked" type="text" size="10" name="a6" maxlength="10" value="<?php echo $a6; ?>" disabled="true" />
					<td align="center"><input class="englishlocked" type="text" size="10" name="b6" maxlength="10" value="<?php echo $b6; ?>" disabled="true" />
					<td align="center"><input class="englishlocked" type="text" size="10" name="c6" maxlength="10" value="<?php echo $c6; ?>" disabled="true" />
					<td align="center"><input class="englishlocked" type="text" size="10" name="d6" maxlength="10" value="<?php echo $d6; ?>" disabled="true" />
					<td align="center"><input class="englishlocked" type="text" size="10" name="e6" maxlength="10" value="<?php echo $e6; ?>" disabled="true" />
					<td align="center"><input class="englishlocked" type="text" size="10" name="f6" maxlength="10" value="<?php echo $f6; ?>" disabled="true" />
				</tr>
				<tr>
					<th align="left">fdjk;s ij fn;k x;k {ks=Qy</th>
					<td align="center"><input class="english" type="text" size="10" name="a7" maxlength="10" value="<?php echo $a7; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="b7" maxlength="10" value="<?php echo $b7; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="c7" maxlength="10" value="<?php echo $c7; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="d7" maxlength="10" value="<?php echo $d7; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="e7" maxlength="10" value="<?php echo $e7; ?>" />
					<td align="center"><input class="english" type="text" size="10" name="f7" maxlength="10" value="<?php echo $f7; ?>" />
				</tr>
				<tr>
					<td></td>
					<td colspan="3"><input type="checkbox" name="resmainroad" value = "<?php echo $resmainroad; ?>" <?php if($resmainroad=='1') {echo 'checked';} else {echo 'unchecked';} ?>> D;k vkoklh; Hkou eq[; lM+d@cktk+j ij vkrk gS \</td>

					<td colspan="3"><input type="checkbox" name="indmainroad" value = "<?php echo $indmainroad; ?>" <?php if($indmainroad=='1') {echo 'checked';} else {echo 'unchecked';} ?>> D;k O;kolkf;d Hkou eq[; lM+d@cktk+j ij vkrk gS \</td>					
				</tr>
				<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
				<tr>
					<th align="left" rowspan="3">Vhi %&</th>
					<td colspan="6">fuekZ.k oxZ 1 & vkj- lh- lh @ vkj- ch- lh- @ iRFkj dh Nr;qDr iDds Hkou A</th>
				</tr>
				<tr>
					<td colspan="6">fuekZ.k oxZ 2 & lhesUV ;k yksgs dh pknj ;k ?kjsyw VkbYl dh Nr;qDr vkaf'kd iDds Hkou A</th>
				</tr>
				<tr>
					<td colspan="6">fuekZ.k oxZ 3 & vU; vkaf'kd iDds ;k dPps Hkou tks mijksDr esa ugha vkrs A</th>
				</tr>
				</table>
			</tr>
		<table>
			<tr>
				<td id="labelmust">Hkou fuekZ.k dk o"kZ %</td>
				<td><input class="english" type="text" size="10" name="buildingyear" maxlength="4" value="<?php echo $buildingyear; ?>" />
				<td id="labelopt">NwV oxZ %</td>
				<td>
					<select name="concessiontype" id="concession" value="<?php echo $concessiontype; ?>">
						<option value="no" selected>dqN ugha</option>
						<option value="1">ifjR;Drk</option>
						<option value="2">fo/kok</option>
						<option value="3">ekufld :i ls fodykax</option>
						<option value="4">us=ghu</option>
						<option value="5">Hkw- iw- lSfud</option>
						<option value="6">Lora=rk lsukuh</option>
						<option value="6">jkT; ljdkj</option>
						<option value="7">la?k ljdkj</option>
						<option value="8">uxj fuxe</option>
						<option value="9">'kS{kf.kd laLFkku</option>
						<option value="10">ijekfFkZd laLFkk</option>
					</select>
				</td>
			</tr>
			<tr>
				<td id="labelopt">uy dusD'ku dk izdkj %</td>
				<td>
					<select name="watertype" id="water" value="<?php echo $watertype; ?>">
						<option value="no" selected>ugha gS</option>
						<option value="1">?kjsyw</option>
						<option value="2">O;kolkf;d</option>
						<option value="3">vkS|ksfxd</option>
					</select>
				</td>
				<td id="labelopt">dkMZ dzekad %</td>
				<td><input class="englishlocked" type="text" size="10" name="watercardno" maxlength="40" value="<?php echo $watercardno; ?>" disabled />
				<td id="labelopt">yst+j dzekad %</td>
				<td><input class="englishlocked" type="text" size="10" name="waterledgerno" maxlength="40" value="<?php echo $waterledgerno; ?>" disabled />
			</tr>
			<tr>
				<td id="labelopt">Hkou cukus gsrq vuqKk \</td>
				<td>
					<select name="anugya" id="anugya" value="<?php echo $anugya; ?>">
						<option value="no" selected>ugha gS</option>
						<option value="1">gS</option>
					</select>
				</td>
				<td id="labelopt">Hkwfe dk izdkj %</td>
				<td>
					<select name="landtype" id="landtype" value="<?php echo $landtype; ?>">
						<option value="personal" selected>futh</option>
						<option value="govt">'kkldh;</option>
					</select>
				</td>
				<td id="labelopt">fujh{k.k fnukad %</td>
				<td><input class="english" type="text" size="20" name="checkdate" maxlength="40" value="<?php echo $checkdate; ?>" />
			</tr>
		</table>
	</div>
	<div id="menu">
	<table>
		<tr>
			<td>
				<input type="submit" value="Save" name="btnspsave" />
	</form>
				<input type="button" value="Save And Get Tax Report" name="btnspsaveandreport" onclick="location.href='/sp/spnew.php';" />
				<input type="button" value="Print" name="btnspprint" onclick="location.href='/sp/spnew.php';" />
				<input type="button" value="Back" name="btnspback" onclick="location.href='/sp.php';" />
			</td>
		</tr>
	</table>
	</div>
</div>
<?php include_once '../footer.php'; 
}

include_once '../functions/connect-db.php';
if(isset($_POST['btnsave']))
{
	$entyear = mysql_real_escape_string(htmlspecialchars($_POST['entyear']));
	$demandno = mysql_real_escape_string(htmlspecialchars($_POST['demandno']));
	$censusno = mysql_real_escape_string(htmlspecialchars($_POST['censusno']));
	$name = mysql_real_escape_string(htmlspecialchars($_POST['name']));
	$caste = mysql_real_escape_string(htmlspecialchars($_POST['caste']));
	$address = mysql_real_escape_string(htmlspecialchars($_POST['address']));
	$mobile = mysql_real_escape_string(htmlspecialchars($_POST['mobile']));
	$colony = mysql_real_escape_string(htmlspecialchars($_POST['colony']));
	$houseno = mysql_real_escape_string(htmlspecialchars($_POST['houseno']));
	$wardno = mysql_real_escape_string(htmlspecialchars($_POST['wardno']));
	$nv1 = mysql_real_escape_string(htmlspecialchars($_POST['nv1']));
	$nv2 = mysql_real_escape_string(htmlspecialchars($_POST['nv2']));
	$nv3 = mysql_real_escape_string(htmlspecialchars($_POST['nv3']));
	$nv4 = mysql_real_escape_string(htmlspecialchars($_POST['nv4']));
	$nv5 = mysql_real_escape_string(htmlspecialchars($_POST['nv5']));
	$nv6 = mysql_real_escape_string(htmlspecialchars($_POST['nv6']));
	$resmainroad = mysql_real_escape_string(htmlspecialchars($_POST['resmainroad']));
	$indmainroad = mysql_real_escape_string(htmlspecialchars($_POST['indmainroad']));
	$a1 = mysql_real_escape_string(htmlspecialchars($_POST['a1']));
	$a2 = mysql_real_escape_string(htmlspecialchars($_POST['a2']));
	$a3 = mysql_real_escape_string(htmlspecialchars($_POST['a3']));
	$a4 = mysql_real_escape_string(htmlspecialchars($_POST['a4']));
	$a5 = mysql_real_escape_string(htmlspecialchars($_POST['a5']));
	$a6 = mysql_real_escape_string(htmlspecialchars($_POST['a6']));
	$a7 = mysql_real_escape_string(htmlspecialchars($_POST['a7']));
	$b1 = mysql_real_escape_string(htmlspecialchars($_POST['b1']));
	$b2 = mysql_real_escape_string(htmlspecialchars($_POST['b2']));
	$b3 = mysql_real_escape_string(htmlspecialchars($_POST['b3']));
	$b4 = mysql_real_escape_string(htmlspecialchars($_POST['b4']));
	$b5 = mysql_real_escape_string(htmlspecialchars($_POST['b5']));
	$b6 = mysql_real_escape_string(htmlspecialchars($_POST['b6']));
	$b7 = mysql_real_escape_string(htmlspecialchars($_POST['b7']));
	$c1 = mysql_real_escape_string(htmlspecialchars($_POST['c1']));
	$c2 = mysql_real_escape_string(htmlspecialchars($_POST['c2']));
	$c3 = mysql_real_escape_string(htmlspecialchars($_POST['c3']));
	$c4 = mysql_real_escape_string(htmlspecialchars($_POST['c4']));
	$c5 = mysql_real_escape_string(htmlspecialchars($_POST['c5']));
	$c6 = mysql_real_escape_string(htmlspecialchars($_POST['c6']));
	$c7 = mysql_real_escape_string(htmlspecialchars($_POST['c7']));
	$d1 = mysql_real_escape_string(htmlspecialchars($_POST['d1']));
	$d2 = mysql_real_escape_string(htmlspecialchars($_POST['d2']));
	$d3 = mysql_real_escape_string(htmlspecialchars($_POST['d3']));
	$d4 = mysql_real_escape_string(htmlspecialchars($_POST['d4']));
	$d5 = mysql_real_escape_string(htmlspecialchars($_POST['d5']));
	$d6 = mysql_real_escape_string(htmlspecialchars($_POST['d6']));
	$d7 = mysql_real_escape_string(htmlspecialchars($_POST['d7']));
	$e1 = mysql_real_escape_string(htmlspecialchars($_POST['e1']));
	$e2 = mysql_real_escape_string(htmlspecialchars($_POST['e2']));
	$e3 = mysql_real_escape_string(htmlspecialchars($_POST['e3']));
	$e4 = mysql_real_escape_string(htmlspecialchars($_POST['e4']));
	$e5 = mysql_real_escape_string(htmlspecialchars($_POST['e5']));
	$e6 = mysql_real_escape_string(htmlspecialchars($_POST['e6']));
	$e7 = mysql_real_escape_string(htmlspecialchars($_POST['e7']));
	$f1 = mysql_real_escape_string(htmlspecialchars($_POST['f1']));
	$f2 = mysql_real_escape_string(htmlspecialchars($_POST['f2']));
	$f3 = mysql_real_escape_string(htmlspecialchars($_POST['f3']));
	$f4 = mysql_real_escape_string(htmlspecialchars($_POST['f4']));
	$f5 = mysql_real_escape_string(htmlspecialchars($_POST['f5']));
	$f6 = mysql_real_escape_string(htmlspecialchars($_POST['f6']));
	$f7 = mysql_real_escape_string(htmlspecialchars($_POST['f7']));
	$totalplotarea = mysql_real_escape_string(htmlspecialchars($_POST['totalplotarea']));
	$totaldevarea = mysql_real_escape_string(htmlspecialchars($_POST['totaldevarea']));
	$totalplotopenarea = mysql_real_escape_string(htmlspecialchars($_POST['totalplotopenarea']));
	$buildingyear = mysql_real_escape_string(htmlspecialchars($_POST['buildingyear']));
	$concessiontype = mysql_real_escape_string(htmlspecialchars($_POST['concessiontype']));
	$watertype = mysql_real_escape_string(htmlspecialchars($_POST['watertype']));
	$watercardno = mysql_real_escape_string(htmlspecialchars($_POST['watercardno']));
	$waterledgerno = mysql_real_escape_string(htmlspecialchars($_POST['waterledgerno']));
	$anugya = mysql_real_escape_string(htmlspecialchars($_POST['anugya']));
	$landtype = mysql_real_escape_string(htmlspecialchars($_POST['landtype']));
	$checkdate = mysql_real_escape_string(htmlspecialchars($_POST['checkdate']));
        
	if(mysql_num_rows(mysql_query("SELECT * FROM sform WHERE demandno='$demandno'")) > 0)
	{
		echo "<script type='text/javascript'>alert('The record already exists, change demand number.');</script>";
		renderform($entyear, $demandno, $censusno, $name, $caste, $address, $mobile, $colony, $houseno, $wardno, $nv1, $nv2, $nv3, $nv4, $nv5, $nv6, $resmainroad, $indmainroad, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $e1, $e2, $e3, $e4, $e5, $e6, $e7, $f1, $f2, $f3, $f4, $f5, $f6, $f7, $totalplotarea, $totaldevarea, $totalplotopenarea, $buildingyear, $concessiontype, $watertype, $watercardno, $waterledgerno, $anugya, $landtype, $checkdate);
	} else
	{
		$sql = "INSERT sform SET entyear='$entyear', demandno='$demandno', censusno='$censusno', name='$name', caste='$caste', address='$address', mobile='$mobile', colony='$colony', houseno='$houseno', wardno='$wardno', nv1='$nv1', nv2='$nv2', nv3='$nv3', nv4='$nv4', nv5='$nv5', nv6='$nv6', resmainroad='$resmainroad', indmainroad='$indmainroad', a1='$a1', a2='$a2', a3='$a3', a4='$a4', a5='$a5', a6='$a6', a7='$a7', b1='$b1', b2='$b2', b3='$b3', b4='$b4', b5='$b5', b6='$b6', b7='$b7', c1='$c1', c2='$c2', c3='$c3', c4='$c4', c5='$c5', c6='$c6', c7='$c7', d1='$d1', d2='$d2', d3='$d2', d3='$d3', d4='$d4', d5='$d5', d6='$d6', d7='$d7', e1='$e1', e2='$e2', e3='$e3', e4='$e4', e5='$e5', e6='$e6', e7='$e7', f1='$f1', f2='$f2', f3='$f3', f4='$f4', f5='$f5', f6='$f6', f7='$f7', totalplotarea='$totalplotarea', totaldevarea='$totaldevarea', totalplotopenarea='$totalplotopenarea', buildingyear='$buildingyear', concessiontype='$concessiontype', watertype='$watertype', watercardno='$watercardno', waterledgerno='$waterledgerno', anugya='$anugya', landtype='$landtype', checkdate='$checkdate'";
		mysql_query($sql) or die("Error querying table: ". mysql_error());
		mysql_close($db);
		echo "<script type='text/javascript'>alert('Successfully saved the data.');window.location.href = 'sp.php';</script>";
	}
	exit();
}
else
{
	renderform('', '', '', '', '', '', '', '', '', '', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'dqN ugha', 'ugha gS', '', '', 'ugha gS', 'futh', '');
}
?>

 

[attachment deleted by admin]

Link to comment
Share on other sites

I some how managed to go one step forward, the error was on line:

 

if(isset($_POST['btnsave']))

 

It must be:

if(isset($_POST['btnspsave']))

 

But now the code is giving me some other errors: Have a look:

 

Notice: Undefined index: address in /home/shrinu/server/sp/spnew.php on line 250 Notice: Undefined index: mobile in /home/shrinu/server/sp/spnew.php on line 251 Notice: Undefined index: a6 in /home/shrinu/server/sp/spnew.php on line 268 Notice: Undefined index: b6 in /home/shrinu/server/sp/spnew.php on line 275 Notice: Undefined index: c6 in /home/shrinu/server/sp/spnew.php on line 282 Notice: Undefined index: d6 in /home/shrinu/server/sp/spnew.php on line 289 Notice: Undefined index: e6 in /home/shrinu/server/sp/spnew.php on line 296 Notice: Undefined index: f6 in /home/shrinu/server/sp/spnew.php on line 303 Notice: Undefined index: totalplotarea in /home/shrinu/server/sp/spnew.php on line 305 Notice: Undefined index: totaldevarea in /home/shrinu/server/sp/spnew.php on line 306 Notice: Undefined index: totalplotopenarea in /home/shrinu/server/sp/spnew.php on line 307 Notice: Undefined index: watercardno in /home/shrinu/server/sp/spnew.php on line 311 Notice: Undefined index: waterledgerno in /home/shrinu/server/sp/spnew.php on line 312 Error querying table: Column 'd3' specified twice

 

Please help me in rectifying.

Link to comment
Share on other sites

Notice: Undefined index: address in /home/shrinu/server/sp/spnew.php on line 250 Notice: Undefined index: mobile in /home/shrinu/server/sp/spnew.php on line 251 Notice: Undefined index: a6 in /home/shrinu/server/sp/spnew.php on line 268 Notice: Undefined index: b6 in /home/shrinu/server/sp/spnew.php on line 275 Notice: Undefined index: c6 in /home/shrinu/server/sp/spnew.php on line 282 Notice: Undefined index: d6 in /home/shrinu/server/sp/spnew.php on line 289 Notice: Undefined index: e6 in /home/shrinu/server/sp/spnew.php on line 296 Notice: Undefined index: f6 in /home/shrinu/server/sp/spnew.php on line 303 Notice: Undefined index: totalplotarea in /home/shrinu/server/sp/spnew.php on line 305 Notice: Undefined index: totaldevarea in /home/shrinu/server/sp/spnew.php on line 306 Notice: Undefined index: totalplotopenarea in /home/shrinu/server/sp/spnew.php on line 307 Notice: Undefined index: watercardno in /home/shrinu/server/sp/spnew.php on line 311 Notice: Undefined index: waterledgerno in /home/shrinu/server/sp/spnew.php on line 312

I don't see form elements with those names. For example, there's no name=address (but there is a name=youraddress)...

Error querying table: Column 'd3' specified twice

Read the message. Look at the query.

Link to comment
Share on other sites

Hello there,

 

the problem has been solved by me only.. with a little effort:

 

Here is the corrected code for other users (so that they can understand that PHP is a very nice language, just we need a little patience):

 

<?php
function renderform($entyear, $demandno, $censusno, $name, $caste, $address, $mobile, $colony, $houseno, $wardno, $nv1, $nv2, $nv3, $nv4, $nv5, $nv6, $resmainroad, $indmainroad, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $e1, $e2, $e3, $e4, $e5, $e6, $e7, $f1, $f2, $f3, $f4, $f5, $f6, $f7, $totalplotarea, $totaldevarea, $totalplotopenarea, $buildingyear, $concessiontype, $watertype, $watercardno, $waterledgerno, $anugya, $landtype, $checkdate)
{ 
	include_once '../header.php';
	include_once '../config/config.php';
	include_once '../functions/functions.php';
	extract($GLOBALS);

$resultward = mysql_query("SELECT * FROM wards order by wardno") 
				or die(mysql_error()); 
?>

<link rel=stylesheet HREF="/css/sp.css" type="text/css" media="screen">
<div id="content">
	<div id="labelopt"><div class="box"></div> jax ds lHkh dkWye vfuok;Z gSa A  'kwU; ls Hkjs gq;s fdlh Hkh dkWye dks [kkyh ugha NksM+sa] vxj dksbZ izfo"Bh ugha gks rks 0 M+kysa A</div>
	<div id="labelopt"></div>
	<h2>u;s losZ{k.k QkeZ dk la;kstu</h2>
	<div id="dp-sp">
	<form name="spnewform" action="" method="post" onsubmit="return ValidateFormSPNew()">
		<table>
			<tr>
				<td id="labelmust">fMek.M dzekad %</td>
				<td><input class="english" type="text" size="10%" name="demandno" maxlength="40" value="<?php echo $demandno; ?>" /></td>
				<td id="labelopt">tux.kuk dz- %</td>
				<td><input class="hindi" size="20%" type="text" size="15%" name="censusno" maxlength="30" value="<?php echo $censusno; ?>"/></td>
				<td width="5%" id="labelmust">o"kZ %</td>
				<td><input class="english" type="text" size="8%" name="entyear" maxlength="4" value="<?php echo $entyear; ?>"/></td>
			</tr>
			<tr>
				<td id="labelmust">laiRrh ds Lokeh dk uke %</td>
				<td><input class="hindi" type="text" name="name" maxlength="100" value="<?php echo $name; ?>"/></td>
				<td id="labelopt">tkfr %</td>
				<td colspan="3"><input class="hindi" type="text" size="20%" name="caste" maxlength="50" value="<?php echo $caste; ?>"/></td>
			</tr>
			<tr>
				<td id="labelopt">laiRrh ds Lokeh dk irk %</td>
				<td colspan="5"><input class="hindi" type="text" size="40%" name="address" maxlength="100" value="<?php echo $address; ?>"/></td>
			</tr>
			<tr>
				<td id="labelopt">eksckbZy %</td>
				<td><input class="english" size="15%" type="text" name="mobile" maxlength="11" value="<?php echo $mobile; ?>"/></td>
				<td id="labelopt">IykV @ edku dzekad %</td>
				<td colspan="3"><input class="english" size="15%" type="text" name="houseno" maxlength="40" value="<?php echo $houseno; ?>"/></td>
			</tr>
			<tr>
				<td id="labelopt">eksgYyk %</td>
				<td><input class="hindi" type="text" size="40%" name="colony" maxlength="100" value="<?php echo $colony; ?>"/></td>
				<td id="labelmust">okMZ dzekad %</td>
				<td>
					<select name="wardno" id="wardno" size="1%">
						<?php
						while($rowward = mysql_fetch_array( $resultward )) {
							echo "\n<option value='".$rowward['wardno']."'>".$rowward['wardno']."% ".$rowward['name']."</option>";
						}
						echo "\n";
						?>
					</select>
				</td>
			</tr>
			<tr>
				<td id="labelmust">dqy {ks=Qy %</td>
				<td><input class="english" type="text" name="totalplotarea" maxlength="10" size="10%" value="<?php echo $totalplotarea; ?>"/></td>
				<td id="labelmust">fufeZr {ks=Qy %</td>
				<td><input class="english" type="text" name="totaldevarea" maxlength="10" size="10%" value="<?php echo $totaldevarea; ?>"/></td>
			</tr>
			<tr>
				<td id="labelmust">[kqyh Hkweh dk {ks=Qy %</td>
				<td><input class="english" type="text" name="totalplotopenarea" maxlength="10" size="10%" value="<?php echo $totalplotopenarea; ?>"/></td>
			</tr>			
		</table>

		<h3>fufeZr {ks= ds orZeku mi;ksx dh tkudkjh</h3>

		<table width="98%" border="1px" cellspacing="0" cellpadding="2px">
			<tr>
				<th rowspan="2">fufeZr {ks= dk izdkj</th>
				<th colspan="3">vkoklh;</th>
				<th colspan="3">O;kolkf;d@vkS|ksfxd</th>
			</tr>
			<tr>
				<th>fuekZ.k oxZ 01</th>
				<th>fuekZ.k oxZ 02</th>
				<th>fuekZ.k oxZ 03</th>
				<th>fuekZ.k oxZ 01</th>
				<th>fuekZ.k oxZ 02</th>
				<th>fuekZ.k oxZ 03</th>
			</tr>
			<tr>
				<th align="right">Hkou dk izdkj %</th>
				<th><input type="checkbox" name="nv1" value = "<?php echo $nv1; ?>" <?php if($nv1=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
				<th><input type="checkbox" name="nv2" value = "<?php echo $nv2; ?>" <?php if($nv2=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
				<th><input type="checkbox" name="nv3" value = "<?php echo $nv3; ?>" <?php if($nv3=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
				<th><input type="checkbox" name="nv4" value = "<?php echo $nv4; ?>" <?php if($nv4=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
				<th><input type="checkbox" name="nv5" value = "<?php echo $nv5; ?>" <?php if($nv5=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
				<th><input type="checkbox" name="nv6" value = "<?php echo $nv6; ?>" <?php if($nv6=='1') {echo 'checked';} else {echo 'unchecked';} ?>></th>
			</tr>
			<tr>
				<th align="left">Hkwry</th>
				<td align="center"><input class="english" type="text" size="10" name="a1" maxlength="10" value="<?php echo $a1; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="b1" maxlength="10" value="<?php echo $b1; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="c1" maxlength="10" value="<?php echo $c1; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="d1" maxlength="10" value="<?php echo $d1; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="e1" maxlength="10" value="<?php echo $e1; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="f1" maxlength="10" value="<?php echo $f1; ?>" />
			</tr>
			<tr>
				<th align="left">izFke ry</th>
				<td align="center"><input class="english" type="text" size="10" name="a2" maxlength="10" value="<?php echo $a2; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="b2" maxlength="10" value="<?php echo $b2; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="c2" maxlength="10" value="<?php echo $c2; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="d2" maxlength="10" value="<?php echo $d2; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="e2" maxlength="10" value="<?php echo $e2; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="f2" maxlength="10" value="<?php echo $f2; ?>"" />
			</tr>
			<tr>
				<th align="left">f}rh; ry</th>
				<td align="center"><input class="english" type="text" size="10" name="a3" maxlength="10" value="<?php echo $a3; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="b3" maxlength="10" value="<?php echo $b3; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="c3" maxlength="10" value="<?php echo $c3; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="d3" maxlength="10" value="<?php echo $d3; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="e3" maxlength="10" value="<?php echo $e3; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="f3" maxlength="10" value="<?php echo $f3; ?>" />
			</tr>
			<tr>
				<th align="left">r`rh; ry ls mij</th>
				<td align="center"><input class="english" type="text" size="10" name="a4" maxlength="10" value="<?php echo $a4; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="b4" maxlength="10" value="<?php echo $b4; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="c4" maxlength="10" value="<?php echo $c4; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="d4" maxlength="10" value="<?php echo $d4; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="e4" maxlength="10" value="<?php echo $e4; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="f4" maxlength="10" value="<?php echo $f4; ?>" />
			</tr>
			<tr>
				<th align="left">Hkwfexr</th>
				<td align="center"><input class="english" type="text" size="10" name="a5" maxlength="10" value="<?php echo $a5; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="b5" maxlength="10" value="<?php echo $b5; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="c5" maxlength="10" value="<?php echo $c5; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="d5" maxlength="10" value="<?php echo $d5; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="e5" maxlength="10" value="<?php echo $e5; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="f5" maxlength="10" value="<?php echo $f5; ?>" />
			</tr>
			<tr>
				<th align="left">dqy</th>
				<td align="center"><input class="englishlocked" type="text" size="10" name="a6" maxlength="10" value="<?php echo $a6; ?>" disabled />
				<td align="center"><input class="englishlocked" type="text" size="10" name="b6" maxlength="10" value="<?php echo $b6; ?>" disabled />
				<td align="center"><input class="englishlocked" type="text" size="10" name="c6" maxlength="10" value="<?php echo $c6; ?>" disabled />
				<td align="center"><input class="englishlocked" type="text" size="10" name="d6" maxlength="10" value="<?php echo $d6; ?>" disabled />
				<td align="center"><input class="englishlocked" type="text" size="10" name="e6" maxlength="10" value="<?php echo $e6; ?>" disabled />
				<td align="center"><input class="englishlocked" type="text" size="10" name="f6" maxlength="10" value="<?php echo $f6; ?>" disabled />
			</tr>
			<tr>
				<th align="left">fdjk;s ij fn;k x;k {ks=Qy</th>
				<td align="center"><input class="english" type="text" size="10" name="a7" maxlength="10" value="<?php echo $a7; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="b7" maxlength="10" value="<?php echo $b7; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="c7" maxlength="10" value="<?php echo $c7; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="d7" maxlength="10" value="<?php echo $d7; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="e7" maxlength="10" value="<?php echo $e7; ?>" />
				<td align="center"><input class="english" type="text" size="10" name="f7" maxlength="10" value="<?php echo $f7; ?>" />
			</tr>
			<tr>
				<td></td>
				<td colspan="3"><input type="checkbox" name="resmainroad" value = "<?php echo $resmainroad; ?>" <?php if($resmainroad=='1') {echo 'checked';} else {echo 'unchecked';} ?>> D;k vkoklh; Hkou eq[; lM+d@cktk+j ij vkrk gS \</td>

				<td colspan="3"><input type="checkbox" name="indmainroad" value = "<?php echo $indmainroad; ?>" <?php if($indmainroad=='1') {echo 'checked';} else {echo 'unchecked';} ?>> D;k O;kolkf;d Hkou eq[; lM+d@cktk+j ij vkrk gS \</td>					
			</tr>
		</table>
		<table>
			<tr>
				<th align="left" rowspan="3">Vhi %&</th>
				<td colspan="6">fuekZ.k oxZ 1 & vkj- lh- lh @ vkj- ch- lh- @ iRFkj dh Nr;qDr iDds Hkou A</th>
			</tr>
			<tr>
				<td colspan="6">fuekZ.k oxZ 2 & lhesUV ;k yksgs dh pknj ;k ?kjsyw VkbYl dh Nr;qDr vkaf'kd iDds Hkou A</th>
			</tr>
			<tr>
				<td colspan="6">fuekZ.k oxZ 3 & vU; vkaf'kd iDds ;k dPps Hkou tks mijksDr esa ugha vkrs A</th>
			</tr>
		</table>

		<h3>vU; tkudkfj;ka</h3>

		<table cellpadding="2px">
			<tr>
				<td id="labelmust">Hkou fuekZ.k dk o"kZ %</td>
				<td><input class="english" type="text" size="10" name="buildingyear" maxlength="4" value="<?php echo $buildingyear; ?>" />
				<td id="labelopt">NwV oxZ %</td>
				<td>
					<select name="concessiontype" id="concession" value="<?php echo $concessiontype; ?>">
						<option value="no" selected>dqN ugha</option>
						<option value="1">ifjR;Drk</option>
						<option value="2">fo/kok</option>
						<option value="3">ekufld :i ls fodykax</option>
						<option value="4">us=ghu</option>
						<option value="5">Hkw- iw- lSfud</option>
						<option value="6">Lora=rk lsukuh</option>
						<option value="6">jkT; ljdkj</option>
						<option value="7">la?k ljdkj</option>
						<option value="8">uxj fuxe</option>
						<option value="9">'kS{kf.kd laLFkku</option>
						<option value="10">ijekfFkZd laLFkk</option>
					</select>
				</td>
			</tr>
			<tr>
				<td id="labelopt">uy dusD'ku dk izdkj %</td>
				<td>
					<select name="watertype" id="water" value="<?php echo $watertype; ?>">
						<option value="no" selected>ugha gS</option>
						<option value="1">?kjsyw</option>
						<option value="2">O;kolkf;d</option>
						<option value="3">vkS|ksfxd</option>
					</select>
				</td>
				<td id="labelopt">dkMZ dzekad %</td>
				<td><input class="englishlocked" type="text" size="10" name="watercardno" maxlength="40" value="<?php echo $watercardno; ?>" disabled />
				<td id="labelopt">yst+j dzekad %</td>
				<td><input class="englishlocked" type="text" size="10" name="waterledgerno" maxlength="40" value="<?php echo $waterledgerno; ?>" disabled />
			</tr>
			<tr>
				<td id="labelopt">Hkou cukus gsrq vuqKk \</td>
				<td>
					<select name="anugya" id="anugya" value="<?php echo $anugya; ?>">
						<option value="no" selected>ugha gS</option>
						<option value="1">gS</option>
					</select>
				</td>
				<td id="labelopt">Hkwfe dk izdkj %</td>
				<td>
					<select name="landtype" id="landtype" value="<?php echo $landtype; ?>">
						<option value="personal" selected>futh</option>
						<option value="govt">'kkldh;</option>
					</select>
				</td>
				<td id="labelopt">fujh{k.k fnukad %</td>
				<td><input class="english" type="text" size="20" name="checkdate" maxlength="40" value="<?php echo $checkdate; ?>" />
			</tr>
		</table>
	</div>
	<div id="menu">
	<table>
		<tr>
			<td>
				<input type="submit" value="Save" name="btnspsave" />
	</form>
				<input type="button" value="Save And Get Tax Report" name="btnspsaveandreport" onclick="location.href='/sp/spnew.php';" />
				<input type="button" value="Print" name="btnspprint" onclick="location.href='/sp/spnew.php';" />
				<input type="button" value="Back" name="btnspback" onclick="location.href='/sp.php';" />
			</td>
		</tr>
	</table>
	</div>
</div>
<?php include_once '../footer.php'; 
}

include_once '../functions/connect-db.php';
if(isset($_POST['btnspsave']))
{
	$entyear = mysql_real_escape_string(htmlspecialchars($_POST['entyear']));
	$demandno = mysql_real_escape_string(htmlspecialchars($_POST['demandno']));
	$censusno = mysql_real_escape_string(htmlspecialchars($_POST['censusno']));
	$name = mysql_real_escape_string(htmlspecialchars($_POST['name']));
	$caste = mysql_real_escape_string(htmlspecialchars($_POST['caste']));
	$address = mysql_real_escape_string(htmlspecialchars($_POST['address']));
	$mobile = mysql_real_escape_string(htmlspecialchars($_POST['mobile']));
	$colony = mysql_real_escape_string(htmlspecialchars($_POST['colony']));
	$houseno = mysql_real_escape_string(htmlspecialchars($_POST['houseno']));
	$wardno = mysql_real_escape_string(htmlspecialchars($_POST['wardno']));
	$nv1 = isset($_POST['nv1']) ? $_POST['nv1'] : '0';
	$nv2 = isset($_POST['nv2']) ? $_POST['nv2'] : '0';
	$nv3 = isset($_POST['nv3']) ? $_POST['nv3'] : '0';
	$nv4 = isset($_POST['nv4']) ? $_POST['nv4'] : '0';
	$nv5 = isset($_POST['nv5']) ? $_POST['nv5'] : '0';
	$nv6 = isset($_POST['nv6']) ? $_POST['nv6'] : '0';
	$resmainroad = isset($_POST['resmainroad']) ? $_POST['resmainroad'] : '0';
	$indmainroad = isset($_POST['indmainroad']) ? $_POST['indmainroad'] : '0';
	$a1 = mysql_real_escape_string(htmlspecialchars($_POST['a1']));
	$a2 = mysql_real_escape_string(htmlspecialchars($_POST['a2']));
	$a3 = mysql_real_escape_string(htmlspecialchars($_POST['a3']));
	$a4 = mysql_real_escape_string(htmlspecialchars($_POST['a4']));
	$a5 = mysql_real_escape_string(htmlspecialchars($_POST['a5']));
	$a6 = isset($_POST['a6']) ? mysql_real_escape_string(htmlspecialchars($_POST['a6'])) : '0';
	$a7 = mysql_real_escape_string(htmlspecialchars($_POST['a7']));
	$b1 = mysql_real_escape_string(htmlspecialchars($_POST['b1']));
	$b2 = mysql_real_escape_string(htmlspecialchars($_POST['b2']));
	$b3 = mysql_real_escape_string(htmlspecialchars($_POST['b3']));
	$b4 = mysql_real_escape_string(htmlspecialchars($_POST['b4']));
	$b5 = mysql_real_escape_string(htmlspecialchars($_POST['b5']));
	$b6 = isset($_POST['b6']) ? mysql_real_escape_string(htmlspecialchars($_POST['b6'])) : '0';
	$b7 = mysql_real_escape_string(htmlspecialchars($_POST['b7']));
	$c1 = mysql_real_escape_string(htmlspecialchars($_POST['c1']));
	$c2 = mysql_real_escape_string(htmlspecialchars($_POST['c2']));
	$c3 = mysql_real_escape_string(htmlspecialchars($_POST['c3']));
	$c4 = mysql_real_escape_string(htmlspecialchars($_POST['c4']));
	$c5 = mysql_real_escape_string(htmlspecialchars($_POST['c5']));
	$c6 = isset($_POST['c6']) ? mysql_real_escape_string(htmlspecialchars($_POST['c6'])) : '0';
	$c7 = mysql_real_escape_string(htmlspecialchars($_POST['c7']));
	$d1 = mysql_real_escape_string(htmlspecialchars($_POST['d1']));
	$d2 = mysql_real_escape_string(htmlspecialchars($_POST['d2']));
	$d3 = mysql_real_escape_string(htmlspecialchars($_POST['d3']));
	$d4 = mysql_real_escape_string(htmlspecialchars($_POST['d4']));
	$d5 = mysql_real_escape_string(htmlspecialchars($_POST['d5']));
	$d6 = isset($_POST['d6']) ? mysql_real_escape_string(htmlspecialchars($_POST['d6'])) : '0';
	$d7 = mysql_real_escape_string(htmlspecialchars($_POST['d7']));
	$e1 = mysql_real_escape_string(htmlspecialchars($_POST['e1']));
	$e2 = mysql_real_escape_string(htmlspecialchars($_POST['e2']));
	$e3 = mysql_real_escape_string(htmlspecialchars($_POST['e3']));
	$e4 = mysql_real_escape_string(htmlspecialchars($_POST['e4']));
	$e5 = mysql_real_escape_string(htmlspecialchars($_POST['e5']));
	$e6 = isset($_POST['e6']) ? mysql_real_escape_string(htmlspecialchars($_POST['e6'])) : '0';
	$e7 = mysql_real_escape_string(htmlspecialchars($_POST['e7']));
	$f1 = mysql_real_escape_string(htmlspecialchars($_POST['f1']));
	$f2 = mysql_real_escape_string(htmlspecialchars($_POST['f2']));
	$f3 = mysql_real_escape_string(htmlspecialchars($_POST['f3']));
	$f4 = mysql_real_escape_string(htmlspecialchars($_POST['f4']));
	$f5 = mysql_real_escape_string(htmlspecialchars($_POST['f5']));
	$f6 = isset($_POST['f6']) ? mysql_real_escape_string(htmlspecialchars($_POST['f6'])) : '0';
	$f7 = mysql_real_escape_string(htmlspecialchars($_POST['f7']));
	$totalplotarea = mysql_real_escape_string(htmlspecialchars($_POST['totalplotarea']));
	$totaldevarea = mysql_real_escape_string(htmlspecialchars($_POST['totaldevarea']));
	$totalplotopenarea = mysql_real_escape_string(htmlspecialchars($_POST['totalplotopenarea']));
	$buildingyear = mysql_real_escape_string(htmlspecialchars($_POST['buildingyear']));
	$concessiontype = mysql_real_escape_string(htmlspecialchars($_POST['concessiontype']));
	$watertype = mysql_real_escape_string(htmlspecialchars($_POST['watertype']));
	$watercardno = isset($_POST['watercardno']) ? mysql_real_escape_string(htmlspecialchars($_POST['watercardno'])) : '';
	$waterledgerno = isset($_POST['watercardno']) ? mysql_real_escape_string(htmlspecialchars($_POST['waterledgerno'])) : '';
	$anugya = mysql_real_escape_string(htmlspecialchars($_POST['anugya']));
	$landtype = mysql_real_escape_string(htmlspecialchars($_POST['landtype']));
	$checkdate = mysql_real_escape_string(htmlspecialchars($_POST['checkdate']));
        
	if(mysql_num_rows(mysql_query("SELECT * FROM sform WHERE demandno='$demandno'")) > 0)
	{
		echo "<script type='text/javascript'>alert('The record already exists, change demand number.');</script>";
		renderform($entyear, $demandno, $censusno, $name, $caste, $address, $mobile, $colony, $houseno, $wardno, $nv1, $nv2, $nv3, $nv4, $nv5, $nv6, $resmainroad, $indmainroad, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $e1, $e2, $e3, $e4, $e5, $e6, $e7, $f1, $f2, $f3, $f4, $f5, $f6, $f7, $totalplotarea, $totaldevarea, $totalplotopenarea, $buildingyear, $concessiontype, $watertype, $watercardno, $waterledgerno, $anugya, $landtype, $checkdate);
	} 
	else
	{
		$sql = "INSERT sform SET entyear='$entyear', demandno='$demandno', censusno='$censusno', name='$name', caste='$caste', address='$address', mobile='$mobile', colony='$colony', houseno='$houseno', wardno='$wardno', nv1='$nv1', nv2='$nv2', nv3='$nv3', nv4='$nv4', nv5='$nv5', nv6='$nv6', resmainroad='$resmainroad', indmainroad='$indmainroad', a1='$a1', a2='$a2', a3='$a3', a4='$a4', a5='$a5', a6='$a6', a7='$a7', b1='$b1', b2='$b2', b3='$b3', b4='$b4', b5='$b5', b6='$b6', b7='$b7', c1='$c1', c2='$c2', c3='$c3', c4='$c4', c5='$c5', c6='$c6', c7='$c7', d1='$d1', d2='$d2', d3='$d2', d4='$d3', d5='$d4', d6='$d5', d7='$d6', e1='$e1', e2='$e2', e3='$e3', e4='$e4', e5='$e5', e6='$e6', e7='$e7', f1='$f1', f2='$f2', f3='$f3', f4='$f4', f5='$f5', f6='$f6', f7='$f7', totalplotarea='$totalplotarea', totaldevarea='$totaldevarea', totalplotopenarea='$totalplotopenarea', buildingyear='$buildingyear', concessiontype='$concessiontype', watertype='$watertype', watercardno='$watercardno', waterledgerno='$waterledgerno', anugya='$anugya', landtype='$landtype', checkdate='$checkdate'";
		mysql_query($sql) or die("Error querying table: ". mysql_error());
		mysql_close($db);
		echo "<script type='text/javascript'>alert('Successfully saved the data.');window.location.href = 'sp.php';</script>";
	}
	exit();
}
else
{
	renderform(Date("Y"), '', '', '', '', '', '', '', '', '', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'dqN ugha', 'ugha gS', '', '', 'ugha gS', 'futh', '');
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.