Tuesday 15 March 2011

php - Server doesnt responds to javascript code while entering a line of text in the input field -



php - Server doesnt responds to javascript code while entering a line of text in the input field -

function removeeditor() { if ( !editor ) return; document.getelementbyid( 'inputbox' ).innerhtml = html = editor.getdata(); var data=encodeuricomponent(html); var topic=document.getelementbyid('currentfield').value; document.getelementbyid('popup').style.display="block"; document.getelementbyid('popup').innerhtml="updating..."; var ajax = ajaxobj("post", "report_viewer.php"); if(topic!=""){ ajax.onreadystatechange = function() { if(ajaxreturn(ajax) == true) { document.getelementsbyname('btnupdate').item(0).style.display = 'none'; document.getelementbyid('popup').style.display="block"; document.getelementbyid('popup').innerhtml=ajax.responsetext; settimeout(function() { document.getelementbyid('popup').style.display="none"; }, 5000); } } ajax.send("data="+data+"&topic="+topic); } document.getelementbyid( 'inputbox' ).style.display = ''; editor.destroy(); editor = null; } <?php if(isset($_post['data'])){ include_once("php_include/db_conx.php"); $topic= $_post['topic']; $comment=($_post['data']); $count=str_word_count(strip_tags(strtolower($comment))); if($count>2500 && ($topic=='introduction' || $topic=='reviewofliterature') ){ echo "can not save more 2500 words"; exit(); }else if($count>30 && $topic=='title'){ echo "can not save more 30 words title"; exit(); }else if($count>600 && $topic=='methodology'){ echo "can not save more 600 words methodology"; exit(); }else if($count>600 && $topic=='objective'){ echo "can not save more 300 words aims & objectives"; exit(); }else{ $sql = "select * tbl_synopsis studentid='$uid'"; $query = mysqli_query($db_conx, $sql); $num_rows=mysqli_num_rows($query); if($num_rows>0){ $sql = "update tbl_synopsis set $topic='$comment' studentid='$uid'"; $query = mysqli_query($db_conx, $sql); echo "updated"; exit(); }else{ $sql = "insert tbl_synopsis(studentid,$topic) values('$uid', '$comment')"; $query = mysqli_query($db_conx, $sql); echo "inserted"; exit(); } } } ?>

when come in line of text input field

comparative study on efficacy of omeprazole pantoprazole prevention , treatment of nsaids related acid peptic disoders.

and press update button calls removeeditor() function server stops responding, when run code locally , come in same text in field work properly. what's wrong code or hosting server's problem?

javascript php

No comments:

Post a Comment