Arekanderu Posted April 11, 2006 Share Posted April 11, 2006 Hello All!I will describe a small problem of mine and i am hoping that somebody can give me an elegant solution.[What I want to do]I am developing a PHP application which it will output at the user a small image with various objects on fixed positions on the image. The user will then be able to drag the mouse on a object, click on it and output information about it. e.g object type, sizeetc. The info for each object are stored in a MySQL db. [The question]As you understand i want to dynamically load the information for each object each time a user "clicks" on a object . What i am having trouble with is HOW am i going to put clickable stuff inside a static image ( the map ) and through PHP will be able to output some useful info to the user. In addition, the image should also be drawn dynamically since i want to show at the user which object is at the moment ocupied by being red ( this info will also be at the DB ). I know that you can do this through GDI but how am i going to do it if i want to combine it with the other thing.If my question isn't that clear or if you think i can help more understanding it please let me know.I have found couple solutions which i do not like so it would really save me some time if anyone has any suggestions. I do not mind using other stuff inside my PHP code ( e.g jscript ) in order to get where i want.Somebody did suggest me map tag of HTML but i want something more dynamic.Cheers and thanks for any replies! Quote Link to comment Share on other sites More sharing options...
Barand Posted April 12, 2006 Share Posted April 12, 2006 If you use a form image[code]<INPUT type='image' src='myimage.php' name='myimage'>[/code]Then it will behave like a button, submitting the form when clicked.To process[code]$xpos = $POST['myimage_x'];$ypos = $POST['myimage_y'];[/code]You now have the coords of the mouseclick within the image. If you know the positions of the objects in your image then you can determine which object was clicked. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.