nochlux Posted May 18, 2013 Share Posted May 18, 2013 the script works, but I wanted to simplify the code if possible! <div id="bottom"> <img src="test.png" id="test" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;"> <img src="test.png" id="test2" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;"> <map name="test"> <form method="post" target ="top> <area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000"> </map> <map name="test2"> <form method="post" target ="top> <area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000"> </map> </form> </div> now on my php pg, i have this if(!empty($_GET['id'])) { $id=$_GET['id'] } if I write this script and run, it works when I use get, but it will not when I replace it POST. How can i fix the html page, for div, form, and map? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/278121-help-me-organizing-the-script/ Share on other sites More sharing options...
cpd Posted May 18, 2013 Share Posted May 18, 2013 If you send POST data to the server, use $_POST - similarly if you send GET data use $_GET. Currently you're posting and using $_GET within your script which will just fail. Quote Link to comment https://forums.phpfreaks.com/topic/278121-help-me-organizing-the-script/#findComment-1430784 Share on other sites More sharing options...
nochlux Posted May 18, 2013 Author Share Posted May 18, 2013 my question was why POST doesn't work while it should work since I put the POST for form method As you can see, it is written as GET, and its actually working, thats why I am asking why this problem is happening Quote Link to comment https://forums.phpfreaks.com/topic/278121-help-me-organizing-the-script/#findComment-1430799 Share on other sites More sharing options...
DavidAM Posted May 18, 2013 Share Posted May 18, 2013 (edited) To the best of my knowledge, an AREA tag does NOT submit a FORM. It is basically an A (anchor) tag that opens a new resource (with a GET request). You have not defined any fields in the FORM tags, so I'm wondering what you are trying to POST? Even when you POST a form, anything in the url after the "?" becomes a GET element, only fields defined in the FORM become POST elements. Here is the code you posted, I just reformatted it a bit -- please use the ... tags for posting code (it's the <> button on the toolbar) <div id="bottom"> <img src="test.png" id="test" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;"> <img src="test.png" id="test2" usemap="#testmap" width="0" height="0" border="0" style="position: relative; top:-0px; visibility: hidden;"> <map name="test"> <form method="post" target ="top> <area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000"> </map> <map name="test2"> <form method="post" target ="top> <area shape="rect" coords="1,1,1,1" onmouseover="display(1);" href="test.php?id=0000"> </map> </form> </div> I've never used MAPs and AREAs, but from what I've read about them, I don't see how this code could "work" at all. 1. Both of your images refer to the same MAP, and that MAP ("testmap") does not exist 2. Both images have width and height of zero and visibility hidden -- perhaps there is some JavaScript in play here? 3. The FORM tag inside the first MAP tag is never closed 4. The FORM tag inside the second MAP tag is closed outside of the MAP tag -- You should never overlap block-level tags. 5. There are no form fields in either form to be submitted 6. The coordinates in both AREA tags define a single-pixel region (that's going to be difficult to click on) [edit] 7. Forms are submitted to the URL specified in the ACTION attribute of the FORM tag. If no ACTION attribute is specified it will submit to "itself" (the same URL as is displaying it). [/edit] Edited May 18, 2013 by DavidAM Quote Link to comment https://forums.phpfreaks.com/topic/278121-help-me-organizing-the-script/#findComment-1430812 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.