[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4284: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4286: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4287: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4288: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
www.dhtmlgoodies.com • View topic - Saving drag and drop content in DB
Advertisement

Saving drag and drop content in DB

Moderators: Calcifer, slothy

Saving drag and drop content in DB

Postby voerman » Wed Aug 23, 2006 2:11 pm

Hi I am using the drag and drop content to position images so I finally manage to create a visual CMS. I managed to get everything working, but I have 1 question:

Right now the system saves everything in one big text field in my .MDB like this:

allItems|DSC03410.jpg;allItems|DSC03411.jpg;allItems|DSC03413.jpg;
allItems|DSC03415.jpg;allItems|DSC03417.jpg;allItems|DSC03420.jpg;
allItems|DSC03423.jpg;allItems|DSC03426.jpg;allItems|DSC03428.jpg;
allItems|DSC03429.jpg;allItems|DSC04121.jpg;allItems|DSC04125.jpg;
allItems|DSC04127.jpg;allItems|DSC04128.jpg;1|DSC03416.jpg;2|DSC03416.jpg;3|DSC03416.jpg

I don't need to save the "allitems" part, cause I populate the left side with system FSO " get files"

But I do want to save the bold parts (images and their positions) into seperate fields in my DB How can I do this ?

I saw a line about exploding but how does that work ? Is it possible to generate different text fields from the script ?

Many thanks and great scripts btw.

greetz
voerman
 
Posts: 4
Joined: Wed Aug 23, 2006 1:58 pm

Postby odinprotectsus » Wed Aug 23, 2006 6:55 pm

odinprotectsus
 
Posts: 21
Joined: Fri Aug 04, 2006 7:11 pm

Postby voerman » Thu Aug 24, 2006 1:51 am

voerman
 
Posts: 4
Joined: Wed Aug 23, 2006 1:58 pm

Postby odinprotectsus » Thu Aug 24, 2006 9:54 pm

I'd put it on the page where the results are sent -- after the code that reads the fields from the form, and before the code that inserts into the DB.

Each field on a form should probably have a function on the receiving page to process it before inserting in the DB; this allows you to check the incoming data before blindlyupdating your DB (very important for security -- you should never trust the data coming from the front-end!).

In this case, that function would parse the data into arrays, and then loop over the arrays to insert or update DB records.
odinprotectsus
 
Posts: 21
Joined: Fri Aug 04, 2006 7:11 pm

Postby voerman » Fri Aug 25, 2006 7:11 am

ok gonna try now
voerman
 
Posts: 4
Joined: Wed Aug 23, 2006 1:58 pm

Postby voerman » Thu Aug 31, 2006 11:06 am

Dear odinprotectsus,

I am not getting it at all. I don't know what you mean where to put the split code etc. Let me be more clear:

I have 2 pages:
1 that shows the drag and drop stuff with the form
1 that gets values from a form and updates the database with these values

To update my database I need to have the values after drag and drop into seperate form fields, not in one field.

I was thinking that instead of presenting the list like this:

{
var saveString = "";
var uls = dragDropTopContainer.getElementsByTagName('UL');
for(var no=0;no<uls.length;no++){ // LOoping through all <ul>
var lis = uls[no].getElementsByTagName('LI');
for(var no2=0;no2<lis.length;no2++){
if(saveString.length>0)saveString = saveString + ";";
saveString = saveString + uls[no].id + '|' + lis[no2].id;
document.forms['myForm'].listOfItems.value = saveString;
}

to change it into something like this:

var saveString = "";
var uls = dragDropTopContainer.getElementsByTagName('UL');
for(var no=0;no<uls.length;no++){ // LOoping through all <ul>
var lis = uls[no].getElementsByTagName('LI');
for(var no2=0;no2<lis.length;no2++){
if(saveString.length>0)saveString = saveString + ";";
saveString = saveString + '<INPUT TYPE=TEXT NAME=PIC' + uls[no].id + 'VALUE=' + lis[no2].id + '>'
document.forms['myForm'].listOfItems.value = saveString;

But that is not working.

Could you help me on this ?

Many thanks in advance.
voerman
 
Posts: 4
Joined: Wed Aug 23, 2006 1:58 pm


Return to Drag and drop scripts

Who is online

Users browsing this forum: No registered users and 20 guests

cron