2

提前感谢大家的帮助。

我想将内容加载到 TinyMCE 文本字段中。

我的代码如下所示:

    <?php
    require_once('adminmenu.php');
    $articleid = $_GET['id'];
    require_once('core/dbconnect.php');

    $qarticles = mysql_query("SELECT * FROM news WHERE id='$articleid' ORDER BY date DESC");
    $row = mysql_fetch_array($qarticles);
    $date = $row['date'];
    $title = $row['title'];
    $shorttitle = $row['shorttitle'];
    $content = $row['content'];
    ?>

    <script src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>
    <script>
        tinymce.init({selector:'textarea'});
    </script>

    <form name="form" method="post" action="articleedit.php?id=<?php echo $id; ?>" onsubmit="return confirm('Are you sure you want to change article?')">
        <p>
            <label for="newsmgstitle"></label>
            <label for="newsmsgdatetime"></label>
        </p>
        <table border="0">
            <tr>
                <td colspan="2" bgcolor="#000000" style="font-weight: bold; color: #FFF;">NEW NEWS ARTICLE</td>
            </tr>
            <tr>
                <td><strong>TIME & DATE</strong></td>
                <td><input type="text" name="newsmsgdatetime" id="newsmsgdatetime" size="25" value="<?php echo $date; ?>"</td>
            </tr>
            <tr>
                <td><strong>TITLE</strong></td>
                <td><input type="text" name="newsmgstitle" id="newsmgstitle" size="50" value="<?php echo $title; ?>"></td>
            </tr>
            <tr>
                <td><strong>SHORT TITLE</strong></td>
                <td><input type="text" name="newsmsgshortitle" id="newsmsgshortitle" size="25" maxlength="25" value="<?php echo $shorttitle; ?>"></td>
            </tr>
            <tr>
                <td colspan="2"><strong>ARTICLE</strong><br>
                    <textarea name="newsmsg" id="newsmsg" cols="80" rows="20" value="<?php echo $content; ?>"></textarea></td>
            </tr>
            <tr>
        <td colspan="2"><input type="submit" name="submitnewsmsg" id="submitnewsmsg" value="PUBLISH ARTICLE"></td>
            </tr>
        </table>
    </form>

如您所见,我在文本字段中做了 value=",但这似乎不起作用。有人可以告诉我该怎么做吗?

4

1 回答 1

7

textarea 的内容包含在 textarea 标签中,例如:

<textarea name="newsmsg" id="newsmsg" cols="80" rows="20" ><?= htmlspecialchars($content); ?></textarea>
于 2013-06-12T02:22:26.557 回答