Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to retrieve the data from ckeditor jquery plugin
    text
    copied!<p>I have spent the last several hours trying to simply post the data (text/html) that was entered in the ckeditor (textarea) to the PHP file. </p> <p>Their API claims that the data automatically posts the data on form submissions, but it does not, it returns nothing. </p> <p>EDIT: here is the real code:</p> <pre><code> &lt;?php require("fns.php"); // grab tab content from database $tab = array(); $query ="SELECT * FROM tabs"; $db_conn = db_connect(); $results = mysql_query($query,$db_conn); while($row = mysql_fetch_array($results)) { $tab[]= $row; } // form validation if($_POST['btnSave']) { // grab selected tab ID $tabId = $_POST['tabId']; $title = $_POST['txtTitle']; $content = $_POST['ckeditor']; // all fields required if(isset($tabId) &amp;&amp; isset($title) &amp;&amp; isset($content)) { // update recorde where id = tabId $query = "UPDATE tabs SET title = '$title', content = '$content' WHERE id = $tabId"; if($content !== "") { if(mysql_query($query,$db_conn)) { $message = "&lt;h3 style='color:#003300;'&gt;Changes Saved!&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;".$content."&lt;/p&gt;"; header("Location:testtabs.php"); } } else { $message ="&lt;h3 style='color: #950000;'&gt;Content cannot be blank!&lt;/h3&gt;"; } } } </code></pre> <p>?></p> <pre><code> &lt;!-- in head section --&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { // inflate ckeditor $('#ckeditor').ckeditor(); //track selected tab var currentId = -1; // Tab initialization var $tabs = $('#tabs').tabs({ select: function(event, ui){ /* ui.index: zero based index selected tab ui.tab: anchor element of the selected tab ui.panel: element containing the content for the selected tab */ // get current tab ID for php script var currentId = ui.index + 1; $("#tabId").val(currentId); var tabName = $(ui.tab).text(); var content = $(ui.panel).html(); // swap title $( '#title' ).val( tabName ); // swap content $("#ckeditor").val(content); } }); </code></pre> <p>}); </p> <pre><code> &lt;body&gt; &lt;?php echo $message; ?&gt; &lt;div id="tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#tabs-1"&gt;&lt;?php echo $tab[0]['title'];?&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#tabs-2"&gt;&lt;?php echo $tab[1]['title'];?&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#tabs-3"&gt;&lt;?php echo $tab[2]['title'];?&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="tabs-1"&gt; &lt;div class="content"&gt; &lt;?php echo $tab[0]['content']; ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="tabs-2"&gt; &lt;div class="content"&gt; &lt;?php echo $tab[1]['content']; ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="tabs-3"&gt; &lt;div class="content"&gt; &lt;?php echo $tab[2]['content']; ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php if (isset($_SESSION['valid_user']) &amp;&amp; ($_SESSION['account_type'] == 'ADMIN')) { // display editor with tab 1 content ?&gt; &lt;table id="tab-editor"&gt; &lt;form action = 'testtabs.php' method ='post'&gt; &lt;input type="hidden" id="tabId" name ="tabId" value="-1"/&gt; &lt;tr&gt;&lt;td&gt;Title: &lt;input type='text' name='txtTitle' id='title' value='&lt;?php echo $tab[0]['title'];?&gt;'/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Tab Content:&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;textarea name='ckeditor' id='ckeditor' class='tab-editor'&gt;&lt;?php //echo $tab[0]['content'];?&gt;&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type='submit' name='btnSave' value='Save Changes' /&gt;&lt;/td&gt; &lt;/form&gt; &lt;/table&gt; &lt;?php } ?&gt; </code></pre> <p></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload