我创建了一个WYSIWYG
'文档'创建者,它在自己的表中发布了一个名为doc_list的表,该表与category
表cat_list
相关联,并且有{{1}收集类别和文档的JOIN
的表。但是,在创建文档时,我希望能够使用复选框显示可用的类别,当您选择它们时,通过获取文档的ID和您选择的ID
来更新连接表属于。
以下是我的表格:
category/categories
这是我的文档创建表单:
cat_list (id,cat_title)
doc_list (id, doc_title)
cat_doc_link_table (id, link_doc_id, link_cat_id)
这是动作脚本:
<?php include 'header.php'; ?>
<?php
require_once '../../db_con.php';
try{
// Selecting entire row from cat_list table
$results = $dbh->query("SELECT * FROM cat_list");
}catch(Exception $e) {
echo $e->getMessage();
die();
}
$cat = $results->fetchAll(PDO::FETCH_ASSOC);
?>
<form action="actions/newDocAdd.php" method="post" id="rtf" name="">
<input type="text" name="doc_title" id="doc_title" required="required" placeholder="Document Title"/><br />
<label><input type="checkbox" name="" class="selectall"/> Select all</label>
<div id="checkboxlist">
<?php
foreach($cat as $cat){
?>
<input type="checkbox" value="<?php echo $cat["cat_id"]; ?>" name="cat_no"><?php echo $cat["cat_title"]; ?></a><br>
<?php
}
?>
</div>
<br>
<button class="postEditBtn" type="button" onclick="ibold()" title="Bold Text"><i class="fa fa-bold"></i></button>
<button class="postEditBtn" type="button" onclick="iitalic()" title="Italic Text"><i class="fa fa-italic"></i></button>
<button class="postEditBtn" type="button" onclick="iunderline()" title="Underline Text"><i class="fa fa-underline"></i></button>
<button class="postEditBtn" type="button" onclick="ifontName()" title="Font Family"><i class="fa fa-font"></i></button>
<button class="postEditBtn" type="button" onclick="ifontsize()" title="Font Size"><i class="fa fa-text-height"></i></button>
<button class="postEditBtn" type="button" onclick="ifontcolor()" title="Font Colour"><i class="fa fa-eraser"></i></button>
<button class="postEditBtn" type="button" onclick="ihiliteColor()" title="Highlight Text"><i class="fa fa-magic"></i></button>
<button class="postEditBtn" type="button" onclick="ilink()" title="Add/Edit Link"><i class="fa fa-link"></i></button>
<button class="postEditBtn" type="button" onclick="iunlink()" title="Remove Link"><i class="fa fa-chain-broken"></i></button>
<button class="postEditBtn" type="button" onclick="ijustifyLeft()" title="Text align-left"><i class="fa fa-align-left"></i></button>
<button class="postEditBtn" type="button" onclick="ijustifyCenter()" title="Text align-center"><i class="fa fa-align-center"></i></button>
<button class="postEditBtn" type="button" onclick="ijustifyRight()" title="Text align-right"><i class="fa fa-align-right"></i></button>
<button class="postEditBtn" type="button" onClick="iUnorderedList()" title="Unordered List"><i class="fa fa-list-ul"></i></button>
<button class="postEditBtn" type="button" onClick="iOrderedList()" title="Ordered List"><i class="fa fa-list-ol"></i></button>
<button class="postEditBtnUndo" type="button" onClick="iUndo()" title="Undo last change"><i class="fa fa-rotate-left"></i></button>
<button class="postEditBtnRedo" type="button" onClick="iRedo()" title="Redo last change"><i class="fa fa-rotate-right"></i></button>
<br><br>
<textarea name="doc_content" id="doc_content" placeholder="Document Content" style="display: none;"></textarea>
<iframe name="editor" id="editor" style="width:100%; height: 600px;"></iframe>
<br><br>
<input onclick="formsubmit()" type="submit" value="Create Document" name="submit"/>
</form>