我這裏有一個問題...我有這個內容的文件map.php:問題越來越瓦爾全球PHP
<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>
我得到了一個地圖上通過鼠標指點的座標,像模擬瓷磚的地圖,所以我寫的函數來獲得鼠標的XY座標上的圖像然後由瓷磚尺寸在更高價值的結果劃分結果,然後ceil()
... voilla ...
一切工作正常,我有座標當我點擊時顯示在<div class="coordxy"
中,但是頁面每次都在刷新,但我不認爲這是問題。
當我想他們在一個iframe'mapxy-handler.php
,它不會工作:
<?php
include '../pages/countrymap/map.php';
global $x;
global $y;
?>
<div class="ffff"><?php echo $x;?></div>
它給了我一些隨機因素來自像提交和2個錯誤map.php文本:
( !)注意:未定義的索引:在第27行的C:\ wamp \ www \ WorldDomination \ pages \ countrymap \ map.php中的foo_x 調用棧 #時間記憶函數位置 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
(! )注意:未定義的索引:在第28行的C:\ wamp \ www \ WorldDomination \ pages \ countrymap \ map.php中的foo_y 012xx調用堆棧 #時間內存函數位置 1 0.0005 357448 {main}()... \ mapxy -handler.php:0 2 0.0007 361304包括( 'C:\ WAMP \ WWW \ WorldDomination \網頁\ countrymap \ map.php')... \ mapxy-handler.php:7
什麼可能會出錯?
其中在形式和成了foo_x ..... foo_y ? –
[PHP:「注意:未定義的變量」,「注意:未定義的索引」和「注意:未定義的偏移量」的可能的重複](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable- notice-undefined-index-and-notice-undef) – Rasclatt
其中where是foo_x和foo_y的輸入值? –