html - Problems getting vars global php -


i have problem here...i have file map.php content:

<html> <head> </head>                          <body>     <div class="wrapper">         <!--harta-->         <form id="harta" action='' method=post style="overflow:scroll; height: 598px; width: 848px;">             <input type="image" src="../../design/images/maps/romania.jpg"  name="foo" style=cursor:crosshair;/>         </form>         <!--bara de coordonate-->         <div class="coordxy" style="hight:30px; width:80px; position:relative; top:-20; left:50px; border:3px solid #42aaf4">             <?php             $foo_x=$_post['foo_x']/20;             $foo_y=$_post['foo_y']/20;             $x=(ceil($foo_x));             $y=(ceil($foo_y));             echo "x=".$x; echo "y=".$y;             ?>         </div>         <!--linkul img-->         <iframe id="detaliisate" src="../../account-handeling/mapxy-handler.php" frameborder="0" border="0" cellspacing="0" style="overflow:scroll; border-style: none; position:relative; width: 150px; height: 120px; margin-right:15px;left:678px; top: -640px;">iframul</iframe>     </div> </body> </html> 

i managed coordinates mouse pointing on map, simulating tiled map, write function mouse x-y coordinates on image divide results tile dimension, ceil() results @ higher value...voilla...

all works fine, have coordinates displayed in <div class="coordxy" when click, page refreshing every time, don't think problem.

when want them in iframe'mapxy-handler.php, wont work:

<?php include '../pages/countrymap/map.php'; global $x; global $y; ?> <div class="ffff"><?php echo $x;?></div> 

it gives me random elements text map.php submit , 2 errors:

( ! ) notice: undefined index: foo_x in c:\wamp\www\worlddomination\pages\countrymap\map.php on line 27 call stack # time memory function location 1 0.0005 357448 {main}( ) ...\mapxy-handler.php:0 2 0.0007 361304 include( 'c:\wamp\www\worlddomination\pages\countrymap\map.php' ) ...\mapxy-handler.php:7

( ! ) notice: undefined index: foo_y in c:\wamp\www\worlddomination\pages\countrymap\map.php on line 28 call stack # time memory function location 1 0.0005 357448 {main}( ) ...\mapxy-handler.php:0 2 0.0007 361304 include( 'c:\wamp\www\worlddomination\pages\countrymap\map.php' ) ...\mapxy-handler.php:7

what may going wrong?

this has nothing globals. you're accessing part of array ($_post) not exist.

this: $_post['foo_x'] throws error can read because key 'foo_x' not exist.

the error bit here:

notice: undefined index: foo_x in c:\wamp\www\worlddomination\pages\countrymap\map.php on line 27

breaking down:

  • there notice
  • you have undefined index
  • it called "foo_x"
  • the file looking "map.php"
  • the line-number 27

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -