error echo id when i want to echo id for edit
- by Prasanta Baidya
I have a entry and edit page of a branch, I want echo id, when I mouse over into edit link in edit button, its show error,: branchedit.php?id=Note:Undefined index:id in line 101, but it work properly in localhost.
error picture page link : https://www.dropbox.com/s/i1vu62lz3pezia0/id%20error.JPG
My code:
<?php
include 'include/config.php';
include 'include/opendb.php';
include 'loginheader.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Branch</title>
<!--Requered Validation -->
<link rel="stylesheet" type="text/css" media="screen" href="jqueryvalidation/demo/css/screen.css" />
<script src="jqueryvalidation/jquery.js" type="text/javascript"></script>
<script src="jqueryvalidation/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#commentForm").validate();
});
</script>
<!--End Requered Validation -->
<style type="text/css">
<!--
body {
background-color: #cccccc;
}
-->
</style>
<style type="text/css">
<!--
-->
</style>
<link href="css/usercss.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style7 {
color: #000000;
font-weight: bold;
}
.style8 {color: #FFFFFF}
-->
</style>
</head>
<body>
<div id="container">
<table width="453" border="0" align="left" cellpadding="0" cellspacing="1">
<tr>
<td width="451"><form name="cmxform" id="commentForm" method="post" action="insert_ac.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td colspan="3" class="style2">Insert Branch into Database </td>
</tr>
<tr>
<td width="100" height="46">Branch Code</td>
<td width="18">:</td>
<td width="309"><input name="branch_code" type="text" id="branch_code" minlength="3" class="required"></td>
</tr>
<tr>
<td height="51">Branch Name</td>
<td>:</td>
<td><input name="branch_name" type="text" id="branch_name" class="required" ></td>
</tr>
<tr>
<td height="47" colspan="3" align="center">
<div align="right">
<input name="Submit" type="submit" class="submit_button" value="Submit" />
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>
<!--Branch List -->
<?php
$sql="SELECT * FROM dc_master";
$result=mysql_query($sql);
?>
<table width="436" border="1" cellpadding="2" cellspacing="0" class="table" id="list">
<tr>
<td colspan="4"><div align="center" class="style7">List of Branches </div></td>
</tr>
<tr class="style4" >
<td width="87" align="center"><span class="style8">Branch Code</span></td>
<td width="176" align="center" ><span class="style8">Branch Name</span></td>
<td width="70" align="center" ><span class="style8">Edit</span></td>
<td width="77" align="center" ><span class="style8">Delete</span></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td height="28"><div align="center" class="style3"><?php echo $rows['branch_code']; ?></div></td>
<td class="style3"> <?php echo $rows['dc_name']; ?></td>
<!--link to update.php and send value of id -->
<td align="center"><a href="branchedit.php?id=<?php echo $rows['id']; ?>" class="style3 style5 style5">Edit</a></td>
<td align="center"><a href="delete.php?id=<?php echo $rows['id']; ?>" class="style3 style5 style5" onclick="return confirm('Are you sure, you want to delete? (After delete you can not undo or get it again) <?php ?>')">Delete</a></td>
</tr>
<?php
}
?>
</table>
<span class="footer">Programmer : Prasanta Baidya / Mobile : 09830980840 / Email id : [email protected]</span></div>
<?php
mysql_close();
?>
</body>
</html>