1
votes

i am using CKEDITOR for designing text and all, but its not able to post into the database.

Ajax script for form submit without page change

<script type="text/javascript" src="JS/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="JS/jquery.validate.min.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#myform").validate({
            debug: false,
            rules: {
cataName: "required",
cataSeo: "required",
cataMetaTitle: "required"
            },
            messages: {
cataName: "Wrong",
cataSeo: "Wrong",
cataMetaTitle: "Wrong"
            },
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('submit?mode=category&value=insert', $("#myform").serialize(), function(data) {
                    $('.result').html(data);
                });
            }
        });
    });
</script>

CKEDITOR JS

<script type="text/javascript" src="JS/ckeditor.js"></script>

Insert Form

<form id="myform" name="myform" action="" method="post">
<textarea rows="10" cols="40" name="cataDesc" class="ckeditor"></textarea>
<input type="submit" value="submit" name="submit" class="sub-btn" />

Post value of cataDesc is not getting in action file. All code are working properly just ckeditor are not working, data is not posting to action file.

3
You have a typo here: <input <type="submit"GluePear
try console.log($("#myform").serialize())Narendrasingh Sisodia
@Uchiha its not workingPratik Soni
Did you check your consoles after console.log($("#myform").serialize()) or without check your network or try to print_r($_POST)Narendrasingh Sisodia
@Uchiha already try with echo for cataDesc its nothing to discplay.Pratik Soni

3 Answers

1
votes

If you want to use jQuery you should use the jQuery adapter, otherwise you're reading the contents of the textarea (hidden) instead of the CKEditor instance that it's shown.

0
votes

Try This One => Your Mistack in code <type="submit" change type="submit"

=> than write Query like this

?php
$content  = $_POST['cataDesc'];
mysql_connect("localhost","root","");
$conn = mysql_select_db("test");
$query = mysql_query("INSERT INTO table VALUES('','one',mysql_real_escape_string($content)");
0
votes

Try to make sure that you dont have any jquery errors in web page. If all runs without issue, then you can get the form values using post method in php file.

$description  = $_POST['cataDesc'];

if(isset($_POST['catDesc']) && $_POST['catDesc'] != '')

{
//put down your query over here.
}