Error message
I have created a table using insert option in PHP. Here the form is working well but it showing some errors like
Notice: Undefined index: sno in E:\wamp\www\Ascent\Adobe Illustrator.php on line 89
May I know what the reason for this error code and how can I find the error.
Another problem is when i am refreshing this page it was automatically adding a row.
If possible can any one please solve my problem.
Here is my php code
<!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>Adobe Illustrator</title>
<link type="text/css" rel="stylesheet" href="Css/AI.css" />
<script language="JavaScript" src="js/calendar.js" type="text/javascript"></script>
<script language="JavaScript" src="js/QuickDates.js" type="text/javascript"></script>
<script>
function getSub(f)
{
f.action.value='Save'
f.submit();
}
//cooldls.com
</script>
<script language="javascript">
function compare(){
var u = u_date
var r = r_date
if(u < r)
{
alert("Please enter date in currect form MM/DD/YYYY");
}
else{
return true;
}
}
</script>
</head>
<body>
<form action="#" method="post" name="Form1" class="a">
<table width="100%" border="0">
<tr>
<td width="18%">S.No.</td>
<td width="82%"><input name="sno" type="text" size="25" /></td>
</tr>
<tr>
<td>Recieved Date</td>
<td><input name="r_date" type="text" size="25" readonly="true" />
<a href="javascript:show_calendar('Form1.r_date');">< img src="Images/newCal2.gif" border="0" align="top"></a></td>
</tr>
<tr>
<td>Up Date</td>
<td><input name="u_date" type="text" size="25" readonly="true" onfocus="compare()" />
<a href="javascript:show_calendar('Form1.u_date');">< img src="Images/newCal2.gif" border="0" align="top"></a></td>
</tr>
<tr>
<td>Plan Name</td>
<td><input name="p_name" type="text" size="25" /></td>
</tr>
<tr>
<td>Client</td>
<td><input name="client" type="text" size="25" /></td>
</tr>
<tr>
<td>Drafter </td>
<td><select name="drafter"/>
<option value="JYO">JYO</option>
<option value="VNK">VNK</option>
<option value="SSR">SSR</option>
<option value="PLN">PLN</option>
</select></td>
</tr>
<tr>
<td>Time Taken</td>
<td><input name="t_taken" type="text" size="25" /></td>
</tr>
<tr>
<td>Amount</td>
<td><input name="amount" type="text" value="$6" size="25" readonly="true" /></td>
</tr>
<tr>
<td align="left"> </td>
<td align="left"><p>
<input name="ok" type="submit" value="OK" onclick='getSub(Form1);'/>
<input type="reset" value="Reset" /></td>
</tr>
</table>
</form>
<a href="AI_Search.php">Show Table</a>
</body>
</html>
<?php
$link = mysql_connect("127.0.0.1","root","");
$DB = mysql_select_db("Illustrator",$link);
$sql = "INSERT INTO AI_floor_plan (sno,r_date,u_date,p_name,clint,drafter,t_taken,am ount)
VALUES ('".$_POST["sno"]."','".$_POST["r_date"]."','".$_POST["u_date"]."','".$_POST["p_name"]."','".$_POST["client"]."','".$_POST["drafter"]."','".$_POST["t_taken"]."','".$_POST["amount"]."')";
if(!mysql_query($sql))
{
die('Not connected : ' . mysql_error());
}
?>
[IMG]C:\Documents and Settings\Administrator\desktop\error message.jpg[/IMG]
|