Passage d'un id dans un formulaire php
Bonjour
toujours ce problème de passage d'id dans mon formulaire php je vous laisse ici mon script si qq pouvait me donner qq pistes, moi je séche... Merci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
<script type="text/javascript">function startWatch(){
if (navigator.geolocation)
var watchId = navigator.geolocation.watchPosition(successCallback,
errorCallback,
{enableHighAccuracy:true,
timeout:10000,
maximumAge:0});
else
alert("Votre navigateur ne prend pas en compte la géolocalisation HTML5");
}
function stopWatch(){
navigator.geolocation.clearWatch(watchId);
} function successCallback(position){
document.getElementById("lat").innerHTML = position.coords.latitude;
document.getElementById("long").innerHTML = position.coords.longitude;
}; function errorCallback(error){
switch(error.code){
case error.PERMISSION_DENIED:
alert("L'utilisateur n'a pas autorisé l'accès à sa position");
break; case error.POSITION_UNAVAILABLE:
alert("L'emplacement de l'utilisateur n'a pas pu être déterminé");
break;
case error.TIMEOUT:
alert("Le service n'a pas répondu à temps");
break;
}
};
</script>
<ul>
<li>Latitude : <span id="lat"></span></li>
<li>Longitude : <span id="long"></span></li>
</ul>
/////////////////////////////////////////////////////////////////////////////////////
<?php
$menu=isset($_POST['menu'])?$_POST['menu']:"";
$latitude=isset($_POST['lat'])?$_POST['lat']:"";
$longitude=isset($_POST['long'])?$_POST['long']:"";
// Action à effectuer:
if ($menu<>""){
// Enregistre dans le fichier fichier.txt:
$msg= x.$lat. r .$long." "."";
$handle = fopen("fichier.txt", "w");
fputs ($handle, $msg.chr(13).chr(10));
aff_fin();
}else{
aff_formulaire();
}
function aff_formulaire(){
echo '<form name="form1" method="POST">';
echo 'Latitude.....: <input type=text name=" id=lat"> ex :47.7255624<br>Longitude: <input type=text name="id_long">ex : 1.7573520<br><input type=hidden name="menu"><input type=submit value="Envoyer" onclick="document.form1.menu.value=\'Envoyer\';"></form>';
}
function aff_fin(){
//echo "Coordonées modifiées ";
echo "<A href='mob.php' target='mob.php'>[ Nouvelle géolocalisation ? ] <A>";
}
fclose($fp);
?> |