plz tell java script checks for not insert blank value in database when using fckeditor?????
when i not insert any record,the script runs like enter ans but value also inserted in data base..i want not insert blank value and check also runs ....
my code is that:
<script type="text/javascript">
function check2()
{
if (document.form1.FCKeditor1.value=="")
{
alert("Must Enter answer");
document.form1.FCKeditor1.focus();
return false;
}
}
</script>
<?php
include 'config.php';
include 'opendb.php';
if(isset($_REQUEST['submitt']))
{
$ans=$_POST['FCKeditor1'];
$sql = "UPDATE class SET answer = '$ans',value='2' WHERE qid='$_REQUEST[qid]' ";
mysql_query($sql);
?>
<script>
alert("reply successfully..");
location.href="main.php";
</script>
<?php
}
?>