Moving images help!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ashwin
Forum Newbie
Posts: 8
Joined: Mon Dec 22, 2003 11:29 pm

Moving images help!!!

Post by ashwin »

Hi,
I need help in pertinent to a "Survey form" and I would be very very grateful if anyone could help me out.

I have created a page which has objects (basically a gif file(s) ) of size Width=100 and Height=40 (along with a few questionnaires). The user can drag this image by clicking on it and also he can rotate it (This is done using HTML and JavaScript). Below these objects I have placed a browser (IE) image file (again a gif file) so that the user can move these objects and place it anywhere on the browser.gif. Also, there will be a Submit button down the page and when the user clicks on the Submit button the user will be taken to a PHP page which indicates "Thank you for your time" and data will be stored in a MySql database file.

Now, coming to the query. When the user drags the object(s) to anywhere in the browser.gif file I need to know the position as to where the user placed the objects and when the user hits the Submit button these position(s) need to be sent to the script and then in turn to the database file. I need to know as to how I can go about in doing this. I hope I was clear with my query and if you are not clear do write back.
Thank you
User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Post by aquila125 »

make a form with some hidden fields.. and let javascript change the values of these fields.. when the users hits the submit button, you can grab the variables from POST or GET..
ashwin
Forum Newbie
Posts: 8
Joined: Mon Dec 22, 2003 11:29 pm

Post by ashwin »

This is the topic I was talking about..here is the link

http://www21.brinkster.com/sashwin/survey/moving.html

do you think finding out the co-ordinates and printing it is the best way???
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

aquila125 has just given you the best way of doing this. As he said, every time an image is moved you need to update a hidden <input> value in a <form> and when the submit button is pressed these values are then sent to your PHP so you can store them.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Just to let you know, the dragging images don't work in Mozilla Firebird :?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Hmmm, I would also be surprised if it works in Netscape considering that event.srcElement is being used.

I have got a little JS script that deals with document objects/events and is pretty browser friendly... I will try and dig it out for shortly.
ashwin
Forum Newbie
Posts: 8
Joined: Mon Dec 22, 2003 11:29 pm

Please Help me!!

Post by ashwin »

Hi,
I have been trying this stuff for the last few hours and I am not able to find the solution. Please do help me out.

I have created a image as seen in this page http://www21.brinkster.com/sashwin/survey/test.html The image can be moved by dragging on it. When you click on the image I get he X and Y co-ordinates but its wrong. Now, the user will move the image wherever he/she wants it to be placed in the browser window. I need to know the co-ordinates of the image as and when the image is dragged and dropped. Can anyone tell me as to how can I do this stuff.

Thnak you
User avatar
Derfel Cadarn
Forum Contributor
Posts: 193
Joined: Thu Jul 17, 2003 12:02 pm
Location: Berlin, Germany

Post by Derfel Cadarn »

DuFF wrote:Just to let you know, the dragging images don't work in Mozilla Firebird :?
The same goes for Konqueror...
Post Reply