mapfu_proto - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of mapfu_proto.php

  1. <html>
  2.   <head>
  3.     <script type="text/javascript">
  4.                 function point_it(event){
  5.                         pos_x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("pointer_div").offsetLeft;
  6.                         pos_y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("pointer_div").offsetTop;
  7.                         document.getElementById("cross").style.left = (pos_x).toString() + 'px';
  8.                       document.getElementById("cross").style.top = (pos_y).toString() + 'px';
  9.                         document.getElementById("cross").style.visibility = "visible" ;
  10.                         document.marqueur.x.value = pos_x;
  11.                         document.marqueur.y.value = pos_y;
  12.                 }
  13.           </script>
  14.   </head>
  15.   <body>
  16.     <div id="pointer_div" onclick="point_it(event)" style="background-image:url('https://framapic.org/GGTGrb9oa7DG/ruSVgrU5YNIU.jpg');width:1024px;height:635px;">
  17.       <img src="https://framapic.org/ehVinffBCbCR/mPVEnnXEWg1J.gif" id="cross" style="position:relative;visibility:hidden;z-index:2;"></div>
  18.     </div>
  19.     <form id="marqueur" name="marqueur" method="post" action="<?php echo basename($_SERVER['PHP_SELF']); ?>">
  20.       <input type="hidden" name="dejarempli" value="1" />
  21.       <label for="nom">Nom du marqueur :</label>
  22.       <input type="text" name="nom" id="nom" value="<?php $nom=(isset($_POST['nom']) ? $_POST['nom'] : ''); echo $nom; ?>"/>
  23.       <label for="x">X :</label>
  24.       <input type="text" name="x" id="x" value="<?php $x=(isset($_POST['x']) ? $_POST['x'] : ''); echo $x; ?>" readonly />
  25.       <label for="y">Y :</label>
  26.       <input type="text" name="y" id="y" value="<?php $x=(isset($_POST['x']) ? $_POST['y'] : ''); echo $x; ?>" readonly />
  27.       <input type="submit" value="Envoyer" onclick="setValue();" />
  28.     </form>
  29.   </body>
  30. </html>
File Description
  • mapfu_proto
  • PHP Code
  • 13 Dec-2018
  • 1.65 Kb
You can Share it: