silverglade Posted August 5, 2010 Share Posted August 5, 2010 hi, I've looked all over the net for solutions and none of the Javascript code snippets they said to add to the image map worked. I am trying to have an image map submit an empty form , and then I check if POSTED with PHP, and if it is posted, I output to the page, "cool it worked". Eventually this is going to be used to change images within a div when the user clicks on an image map it will change to the next image, linked image maps within a div. Not sure if that makes sense. Lol. Ok thanks, any help greatly appreciated. Derek I tried this so far. <?php if(!empty($_POST['mapform'])) { echo "it worked!"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action='aradia.php' method='post' name='mapform'> <img src="aradia.jpg" width="256" height="328" border="0" usemap="#Map" /> <map name="Map" id="Map"><area shape="rect" coords="5,176,81,249" href="javascript:;" onClick="document.mapform.submit()" /></map> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 5, 2010 Share Posted August 5, 2010 Try it like this: <form action="aradia.php" method="post" name="mapform" id="mapform"> <img src="aradia.jpg" width="256" height="328" border="0" usemap="#Map" /> </form> <map name="Map" id="Map"> <area shape="rect" coords="5,176,81,249" href="javascript: void(0);" onclick="javascript: document.getElementById('mapform').submit()" /> </map> Quote Link to comment Share on other sites More sharing options...
silverglade Posted August 5, 2010 Author Share Posted August 5, 2010 Thanks for writing that. I tried it but it doesn't work for me. Here is the code I used for the page. Any more help greatly appreciated! <?php if(!empty($_POST['mapform'])) { echo "it worked !"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="aradia.php" method="post" name="mapform" id="mapform"> <img src="aradia.jpg" width="256" height="328" border="0" usemap="#Map" /> </form> <map name="Map" id="Map"> <area shape="rect" coords="5,176,81,249" href="javascript: void(0);" onclick="javascript: document.getElementById('mapform').submit();" /> </map> </body> </html> Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 5, 2010 Share Posted August 5, 2010 Yeah sorry, the code is right. It's just you're going about it wrong. You'll need a hidden value, because really no post data is being sent because there is nothing to send. Place this just before the closing form tag: <input type="hidden" name="checker" value="checked" /> Then your PHP code should be: if(isset($_POST['checker']) && $_POST['checker'] == 'checked') { echo "it worked !"; } Quote Link to comment Share on other sites More sharing options...
silverglade Posted August 5, 2010 Author Share Posted August 5, 2010 HOLY COW PROJECT FEAR!! HAHHAHAHAHA. IT WORKS!! oh man, you're the best, I've been trying to find a solution for that on the net and google for like 12 hours straight and no sleep. Thank GOD I can freakin go to sleep now thanks to you. HAHA! THanks Project Fear. Derek :D :D :D 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.