Blog Post Issues
2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 16, 2014 (RSS)
By Perchpole - May 1, 2014
Hello, All -
I'm having a couple of problems with a Blog post page on a client's site. The page acts as a normal blog roll. However, if the site admin is logged in then a blog posting gizmo appears at the top of the page. This is a modification of the old UploadForm available from this forum (somewhere!).
It works very well except for two issues:
1) When a person submits a post, the page reloads but doesn't show the latest entry. You have to load the page again before it appears. How can I force the page to refresh as the new post is submitted?
2) I have added a drop-down menu to the form allowing the user to choose from a selection of files which are already loaded into the system. It works fine but I would like to make it a multi-select menu.
Part of the code for the query in the form looks like this...
title = '".mysql_escape( $_REQUEST['title'] )."',
content = '".mysql_escape( $_REQUEST['content'] )."',
linkedAssets = '".mysql_escape( $_REQUEST['assets'] )."',
youTube = '".mysql_escape( $_REQUEST['youTube'] )."'
What I need to do is change the entry for "linkedAssets" to make it handle the data from a multi-select menu. I think I need to turn it into an array but I'm not sure how.
Any help would be most appreciated.
:0)
Perch
By gregThomas - May 16, 2014
Hi Perch,
For the first issue, I'm guessing that you're grabbing the list of posts before the validation/adding of the new post to the database? If you move the getRecords/mysql_select function that gets the lists of posts to after the new post is added to the database, this should resolve the issue. As when the list of records is retrieved, the new record will be in the database.
For the second item, if you're multi value select box looks something like this:
<select name="assets[]" multiple>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Then you could make these values ready for CMSB by converting the array into a tab separated string.
linkedAssets = '\t".mysql_escape( implode("\t", @$_REQUEST['assets']))."\t',
This works because CMS Builder stores multi select values as a tab separated string in a text field.
Let me know if you have any questions.
Thanks!
Greg
PHP Programmer - interactivetools.com