unxposed Posted September 11, 2008 Share Posted September 11, 2008 I've created a small cms to edit articles on my site. I have an option to select a checkbox next to each article and then press the edit button so I can edit multiple articles at once. Each articles textarea field is replaced by FCKeditor. So in PHP I have a while loop which returns each row of data (each article), and places each into a fieldset of which the article content is FCKeditor. When I click on edit, however, this is returning the same value in the iframe of FCKeditor for every article, even though looking at the source reveals the display:none input field has the correct values (which are different). $blog_content = $row['blog_content']; $oFCKeditor = new FCKeditor('blog_content[]') ; $oFCKeditor->BasePath = '../../add_ons/fckeditor/' ; $oFCKeditor->ToolbarSet = 'Basic'; $oFCKeditor->Value = $blog_content ; $oFCKeditor->Create() ; The html that is being poduced: Article one - value of FCKeditor field = 'Content for the first article here' - Actual value = 'Content for the first article here': <input type="hidden" id="blog_content[]" name="blog_content[]" value="Content for the first article here" style="display:none" /><input type="hidden" id="blog_content[]___Config" value="" style="display:none" /><iframe id="blog_content[]___Frame" src="../../add_ons/fckeditor/editor/fckeditor.html?InstanceName=blog_content[]&Toolbar=Basic" width="100%" height="200" frameborder="0" scrolling="no"></iframe> Article two - value of FCKeditor field = 'Content for the first article here' - Actual value = 'Different content here for the second article which isn't appearing in FCKeditor field': <input type="hidden" id="blog_content[]" name="blog_content[]" value="Different content here for the second article which isn't appearing in FCKeditor field" style="display:none" /><input type="hidden" id="blog_content[]___Config" value="" style="display:none" /><iframe id="blog_content[]___Frame" src="../../add_ons/fckeditor/editor/fckeditor.html?InstanceName=blog_content[]&Toolbar=Basic" width="100%" height="200" frameborder="0" scrolling="no"></iframe> It all in context: for ($i = 0; $i<count($_POST["blog_id"]); $i++) { $edit_blog_id = $_POST["blog_id"][$i]; $query = "SELECT * FROM blog WHERE blog_id = $edit_blog_id"; $result = @mysql_query ($query); if ($result) { while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { echo '<fieldset class="project_cms"> <h3>' . $project_title_split[0] . '</h3> <p><label for="blog_title">Title</label> <input type="text" name="blog_title[]" value="' . $row['blog_title'] . '" /></p> <p><label for="blog_content">Content</label></p> <div class="editor">'; $blog_content = $row['blog_content']; $trans = array('\n' => '', '\r' => '', '<p> </p>' => ''); $blog_content = strtr($blog_content, $trans); $trans = array('<' => '<', '>' => '>', '"' => '"'); $blog_content = strtr(stripslashes($blog_content), $trans); $oFCKeditor = new FCKeditor('blog_content[]') ; $oFCKeditor->BasePath = '../../add_ons/fckeditor/' ; $oFCKeditor->ToolbarSet = 'Basic'; $oFCKeditor->Value = $blog_content ; $oFCKeditor->Create() ; echo '<!--editor--></div> <p><label for="blog_image">Image</label> <input type="text" name="blog_image[]" value="' . $row['blog_image'] . '" /><input type="hidden" name="blog_id[]" value="' . $row['blog_id'] . '" /></p> </fieldset>'; } } Has anyone got any ideas on why the smae value is being displayed in all iframes, and what I can do to fix this? Thanks thanks. Quote Link to comment https://forums.phpfreaks.com/topic/123742-solved-multiple-fckeditor-values-all-identicle/ Share on other sites More sharing options...
sasa Posted September 11, 2008 Share Posted September 11, 2008 try to change line $oFCKeditor = new FCKeditor('blog_content[]') ; to $oFCKeditor = new FCKeditor('blog_content['.$i.']') ; Quote Link to comment https://forums.phpfreaks.com/topic/123742-solved-multiple-fckeditor-values-all-identicle/#findComment-638968 Share on other sites More sharing options...
unxposed Posted September 11, 2008 Author Share Posted September 11, 2008 I love you. Quote Link to comment https://forums.phpfreaks.com/topic/123742-solved-multiple-fckeditor-values-all-identicle/#findComment-639001 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.