954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

plz reply me urgent.....plz tell java script checks for not insert blank value in dat

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
}

?>
waqaskhan1
Newbie Poster
1 post since Jul 2009
Reputation Points: 10
Solved Threads: 0
 

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:

<?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); ?> <?php }

?>

Hello waqas,

This is not a place to ask on URGENT basis. please be cool and you will be answered shortly.

emarshah
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You