繁体   English   中英

如何在 php 页面中提交表格 iframe WYSIWYG?

[英]how to submit form iframe WYSIWYG in php page?

我制作了我的所见即所得编辑器,我试图获得所见即所得编辑器的值但没有工作,我有一个 PHP 脚本,我试图在该脚本中插入所见即所得并获取表单中的值。 这是几乎所有页面所见即所得

 var showingSourceCode = false; var isInEditMode = true; function enableDesignMode() { ritchTextFiled.document.designMode = 'on'; } function exeCmd(command) { ritchTextFiled.document.execCommand(command, null, false); } function execCommandWithArg(command, arg) { ritchTextFiled.document.execCommand(command, null, arg); } function toggleSource() { if (showingSourceCode) { ritchTextFiled.document.getElementsByTagName('body')[0].innerHTML = ritchTextFiled.document.getElementsByTagName('body')[0].textContent; showingSourceCode = false; } else { ritchTextFiled.document.getElementsByTagName('body')[0].textContent = ritchTextFiled.document.getElementsByTagName('body')[0].innerHTML; showingSourceCode = true; } } function toggleEdit() { if (isInEditMode) { ritchTextFiled.document.designMode = 'off'; isInEditMode = false; } else { ritchTextFiled.document.designMode = 'on'; isInEditMode = true; } }
 <html> <head> <title>JavaScript</title> <body onload="enableDesignMode();" style="width: 628px;"> <button onclick="toggleSource();"><b>< / ></b></button> <button onclick="exeCmd('bold');"><b>B</b></button> <iframe name="ritchTextFiled" style=" width: 100%;height: 300px;border: 1px solid #2b9ff6; box-shadow: 0 4px 8px 0 rgba(42, 53, 71, 0.2), 0 6px 20px 0 rgba(42, 53, 71, 0.19); "> </iframe>

和这个表单的主页

if(is_post_request()) {

// Create record using post parameters
$args= $_POST['topic'];
$topic = new Topic($args);
$result = $topic->save();

if($result === true) {

  $session->message('The Topic was created successfully.');
  redirect_to(url_for("topic.php"));
} else {
  // show errors
  $session->message('The Topic was created Error.');
  redirect_to(url_for("topic.php"));
}

} else {


}

?>



<form action="<?php echo url_for('ntopic.php'); ?>" method="post">
<div style="margin-bottom: 10px;">
<label for="pagetitle"> Page Titel</label>
<input id="pagetitle" type="text" class="" name="topic[topic_title]" style="width: 96.4%;padding: 10px;font-size: 18px;">
</div>



    <iframe src="WYSIWYG.php" style="width:100%;height:500px;border:0px;background:red;" title="">
    </iframe>


<input type="submit" style="width:100.4%;padding:10px;background:#2a3547;color:#2b9ff6; border:0px;
font
" value="Publish">
</form>

我想在 $_POST['topic']; 中获取 WYSIWYG 的值; 我尽量说清楚,抱歉打扰。

我比这更清楚地提出了新问题并找到了答案谢谢。 这个问题的灵魂

暂无
暂无

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

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