Page 1 of 1

Creating a Drag and Drop page

Posted: Thu Sep 21, 2006 1:10 pm
by emmbec
Hi, I am trying to build a drag and drop page in php but I can't seem to find the answer. This is what I want to do:

I want to build a site for example to build a classroom. I have a CREATE CLASSROOM page, in which the teacher can sort of Draw the tables for the students of the classroom (an image of a circle) draging and droping them on the screen.

I made a quick sketch of what I'm trying to do:
Image


After that is done, in another page we can just look at what we made whithout being able to drag and drop, and be able to click on each table and get details of the table selected

Image


I have the database part done, I know how to do queries and all that stuff, what I don't know is how to make the EDIT page and save it somewhere and after that just consult what I just edited whithout moving the tables.

I have looked up at many JavaScript code that does the drag and drop, but it saves the position of the tables in a cookie and to be honest JavaScript is not one of my strengths. I hope someone can help me out on this one, or if you know a good tutorial page to do this I'd really appretiate it for you to post it here.

Thank you and forgive my English :wink:

Posted: Thu Sep 21, 2006 1:13 pm
by Luke
php can't do things like drag-and-drop because it is executed by the server... not the client machine. Javascript is the way to go here.

Posted: Thu Sep 21, 2006 1:17 pm
by MrPotatoes
AJAX will rock your world

Posted: Thu Sep 21, 2006 1:19 pm
by Burrito
there are a lot of pre-built libraries out there for dragging and dropping.

try googling drag and drop html.

or just look at something like http://script.aculo.us

Posted: Thu Sep 21, 2006 1:23 pm
by Luke
the library burrito mentioned... script.aculo.us is exremely cool. Check it out.

Posted: Thu Sep 21, 2006 4:03 pm
by feyd
Drag'n'drop != PHP. Moved. :roll:

Posted: Thu Sep 21, 2006 5:36 pm
by pickle
If the position of the tables are stored in cookies, why not just use PHP on the next page to read in the cookie data?