can any1 tell me whats wrong with my code.i cannot edit my data

$sql=caseQuery("select dt from update_dt where dt_id=1");
  $row=mysql_fetch_array($sql);
 $dt=$row["dt"];
<div style="position:absolute; top: 250px; left: 500px; width: 4639px; height: 109px;"> 
  <fieldset style="width:20px">
<legend ><b><NOBR>Edit Date</NOBR></b></legend>
<form name="frm"  action="location.php" method="post" >
	<table width="250" border="0">
  <tr>
    <td>
    Date
    </td>
    <td><input name="sdate" id="sdate" type="text" size="15" VALUE="<?php echo $dt; ?>"readonly="readonly" />
  <img src="../images/cal.gif" id="srcDOFImg">
  <link type="text/css" rel="stylesheet" href="../inc/jscalender/css/jscal2.css" />
  <link type="text/css" rel="stylesheet" href="../inc/jscalender/css/border-radius.css" />
  <link id="skin-win2k" title="Win 2K" type="text/css" rel="alternate stylesheet" href="../inc/jscalender/css/win2k/win2k.css" />
  <link id="skinhelper-compact" type="text/css" rel="alternate stylesheet" href="../inc/jscalender/css/reduce-spacing.css" />
  <script src="../inc/jscalender/js/jscal2.js"></script>
  <script src="../inc/jscalender/js/lang/en.js"></script>      
			<script type="text/javascript">
          new Calendar({
                  inputField: "sdate",
                  dateFormat: "%d-%m-%Y",
                  trigger: "srcDOFImg",
                  bottomBar: true,
                  //max:  Calendar.dateToInt(new Date()),
                  onSelect: function() {
                          var date = Calendar.intToDate(this.selection.get());
                          this.hide();
                  }
          });
        </script> 
	</tr>
	</table>
<input type="button" name= "edit" value="Edit" onclick="return checkform();" />
</form>
</fieldset></div>
 if (isset($_POST["edit"]))
{
$dt = escape($_POST['sdate']);
echo "$dt";
$sq=caseQuery("update update_dt set dt='$dt' where dt_id=1");
if($sq)
{
      redirects('location.php');
	  }
	  else
	  {
	  echo "cannot Edit Date";
	  }
}

You should pass date in yyyy-mm-dd format to mysql server

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.