nutt318 Posted February 12, 2009 Share Posted February 12, 2009 Well I have an image with a bunch of buttons and I want to be able to use a hotspot to act as a button to execute some PHP. I have the following but I am in need of some direction. As you can see the image is there and the first hotspot is on the Add Address. When I put my php code in it just creates a normal button. Is there a different spot I need my php code or a differway to complete this? Thanks. <body> <img src="buttons_osc1.gif" width="500" height="305" border="0" usemap="#Map" /> <map name="Map" id="Map"><area shape="rect" coords="56,12,181,33" href=" <?php if($_POST['Submit']){ $open = fopen("hello.txt","a+"); $text = "hello\n"; fwrite($open, $text); fclose($open); } echo "<form action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">"; echo "<input name=\"Submit\" type=\"submit\" value=\"hello\" />\n </form>"; ?>" /></map> </body> Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/ Share on other sites More sharing options...
samshel Posted February 12, 2009 Share Posted February 12, 2009 <body> <img src="buttons_osc1.gif" width="500" height="305" border="0" usemap="#Map" /> <map name="Map" id="Map"><area shape="rect" coords="56,12,181,33" href="#" onclick="javascript:document.frm1.submit();" /></map> <?php if($_POST['Submit']){ $open = fopen("hello.txt","a+"); $text = "hello\n"; fwrite($open, $text); fclose($open); } echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">"; echo "<input name=\"Submit\" type=\"hidden\" value=\"hello\" />\n </form>"; ?> </body> Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/#findComment-760837 Share on other sites More sharing options...
nutt318 Posted February 12, 2009 Author Share Posted February 12, 2009 Very Cool, Thanks samshel! Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/#findComment-760839 Share on other sites More sharing options...
nutt318 Posted February 13, 2009 Author Share Posted February 13, 2009 Well, it doesnt seem to work right. Do I have something wrong again? <body> <img src="control.png" width="600" height="350" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="43,8,105,29" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit100();" /> <area shape="rect" coords="6,35,68,56" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit101();" /> <area shape="rect" coords="80,35,142,56" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit102();" /> <area shape="rect" coords="48,63,102,83" href="http://www.mysite.com/wordpress/control.php" onclick="javascript:document.frm1.submit103();" /> </map> <?php if($_POST['Submit100']){ $open = fopen("commands.dat","a+"); $text = "81\n"; fwrite($open, $text); fclose($open); } echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/control.php']."\" method=\"post\">"; echo "<input name=\"Submit100\" type=\"hidden\" value=\"Submit100\" />\n </form>"; ?> <?php if($_POST['Submit101']){ $open = fopen("commands.dat","a+"); $text = "82\n"; fwrite($open, $text); fclose($open); } echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">"; echo "<input name=\"Submit101\" type=\"hidden\" value=\"Submit101\" />\n </form>"; ?> <?php if($_POST['Submit102']){ $open = fopen("commands.dat","a+"); $text = "85\n"; fwrite($open, $text); fclose($open); } echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">"; echo "<input name=\"Submit102\" type=\"hidden\" value=\"Submit102\" />\n </form>"; ?> <?php if($_POST['Submit103']){ $open = fopen("commands.dat","a+"); $text = "84\n"; fwrite($open, $text); fclose($open); } echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/?page_id=3']."\" method=\"post\">"; echo "<input name=\"Submit103\" type=\"hidden\" value=\"Submit103\" />\n </form>"; ?> </body> Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/#findComment-760973 Share on other sites More sharing options...
samshel Posted February 13, 2009 Share Posted February 13, 2009 u will need seperate forms for each area document.frm1.submit(); submit() is an inbuilt JS function that submits the form...it is not the submit button name, Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/#findComment-760974 Share on other sites More sharing options...
nutt318 Posted February 13, 2009 Author Share Posted February 13, 2009 Well I thought I had the code right but it does all 4 php commands. Is there something out of place? Do I need the map id different? <img src="control.png" width="600" height="350" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="43,8,105,29" href="#" onclick="javascript:document.frm1.submit();" /></map> <map name="Map" id="Map"> <area shape="rect" coords="6,35,68,56" href="#" onclick="javascript:document.frm2.submit();" /></map> <map name="Map" id="Map"> <area shape="rect" coords="80,35,142,56" href="#" onclick="javascript:document.frm3.submit();" /></map> <map name="Map" id="Map"> <area shape="rect" coords="48,63,102,83" href="#" onclick="javascript:document.frm4.submit();" /></map> <?php if($_POST['Submit']){ $open = fopen("commands.dat","a+"); $text = "81\n"; fwrite($open, $text); fclose($open); } echo "<form name='frm1' action=\"".$_SERVER['http://mysite.com/wordpress/control.php']."\" method=\"post\">"; echo "<input name=\"Submit\" type=\"hidden\" value=\"Submit\" />\n </form>"; ?> Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/#findComment-761062 Share on other sites More sharing options...
nutt318 Posted February 13, 2009 Author Share Posted February 13, 2009 I've been trying different ways to format this code and its still not working, I tried changing the form name in the sumbit button but that doesnt seem to work. Is something out of place? Thanks. Link to comment https://forums.phpfreaks.com/topic/144998-hotspot-on-image-then-execute-php-help/#findComment-761247 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.