Creating a Drag and Drop page

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
emmbec
Forum Contributor
Posts: 112
Joined: Thu Sep 21, 2006 12:19 pm
Location: Queretaro, Mexico

Creating a Drag and Drop page

Post 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:
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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.
User avatar
MrPotatoes
Forum Regular
Posts: 617
Joined: Wed May 24, 2006 6:42 am

Post by MrPotatoes »

AJAX will rock your world
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

the library burrito mentioned... script.aculo.us is exremely cool. Check it out.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Drag'n'drop != PHP. Moved. :roll:
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply