douxun2023 2017-01-03 05:05
浏览 72

我无法通过编辑器以格式在php mysql中插入文本作为pareagraphs

I am building a cms in php and inserting large content in database, for that i am using text editor. But when i give blank space inb front of paragraph or i write something on new line its not getting inserted in mysql table. I am giving muy code below...

<script>

        $(function() {

                    $("#btn-submit").click(function() {


                        var content =document.aboutform.descr.value = $('#editor').html();
                        var title=$("#title").val();
                        var id=$("#id").val();
                        //var active = $('input[name=make_active]:checked').val();

                        var dataString ='title1='+title+'&content1='+content+'&id1='+id;
                        //alert(id);
                        //alert(id);

                        //alert(firstname);
                        // Returns successful data submission message when the entered information is stored in database.
                        //var dataString = 'title1=' + title + '&content1=' + content; 
                        //alert(dataString);

                            // AJAX code to submit form.

                        $.ajax({

                            type: "POST",
                            url: "../admin/update_about.php",
                            data: dataString,
                            cache: false,
                            success: function(response) {


                                    $("#status").html(response);

                                                        },

                            });
                            //closes ajax call



            return false;


            });
            //closes button click
    });

    </script>   

And this is php code

$title = $_POST['title1'];
$content = mysql_real_escape_string($_POST['content1']);
$id = $_POST['id1'];
$sql="UPDATE about_us SET title='".$title."',content='".$content."' WHERE about_id= ".$id;
$result=$conn->query($sql);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据