简体   繁体   English

使用POST发送CKEditor内容

[英]Send CKEditor content with POST

I try to include a CKEditor into my Website and for this I have to check, if the Div is empty... Here is my Form-Code: 我尝试将CKEditor包含到我的网站中,为此,我必须检查Div是否为空...这是我的表单代码:

<form action="" method="post">
    <ul class="login">
        <li>
            Thema*:<br>
            // unnessesary
        </li>
        <li>
            Nachricht*:<br>

            <div class="adjoined-bottom">
                <div class="grid-container">
                    <div class="grid-width-100">
                        <div id="editor" placeholder="Schreibe hier dein Text...">
                        </div>
                    </div>
                </div>
            </div>

        </li>

        <li>
            <input type="submit" name="Send" value="Abschicken">
        </li>
    </ul>
</form>

And here is my 'Validate-Code' (In same Document) 这是我的“验证码”(在同一文档中)

if (isset($_GET['mode']) && $_GET['mode'] == 'success') {
    echo "<br>";
    echo success('Emails erfolgreich gesendet!');
} else {
    if (empty($_POST) === false)  {
        if (empty($_POST['subject']) === true || trim($_POST['subject']) == "") {
            $errors[] = 'Ein Thema ist Pflicht';
        }

        if (empty($_POST['body']) === true || trim($_POST['body']) == "") {
            $errors[] = 'Eine Nachricht ist Pflicht';
        }

        if (empty($errors) === false) {
            echo "<br>" . output_errors($errors);
        } else {

            //email('MyEMailAddress', $_POST['subject'], $_POST['body'], 'roundmail');
            //mail_users($_POST['subject'], $body);
            //echo "<meta http-equiv='refresh' content='0; URL=index.php?section=Rundmail&mode=success'>";
            //laden();

            exit();
        }
    }
}

Now my problem is, that I have to check, if the div (id="editor") is empty, or not... If it's possible with PHP, otherwise I have to use Javascript... But I also don't know, how to send the Div-Content with post... 现在我的问题是,我必须检查div(id =“ editor”)是否为空...如果PHP可以,否则我必须使用Javascript ...但我也不要知道,如何发送带帖子的Div-Content ...

I need help, and I hope you understand me (sry, I'm from Germany...) 我需要帮助,希望您能理解我(对不起,我来自德国...)

Add name="editor" to your form element and then it should be on your $_POST['editor'] name="editor"添加到您的表单元素中,然后它应该在您的$_POST['editor']

So if you named your text_area editor you can get it from POST and after that you can check it using php. 因此,如果您命名了text_area编辑器,则可以从POST获取它,然后再使用php对其进行检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM