fonction javascript et onsubmit sur une page
Bonjour
Ci joint mon script je precise que je ne connais pas la programmation en Javasript.
Voilà donc mon PB ci joint le code
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<?php
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1") ) { // enregistrement des données
} // fin de l'enregistrement des données
?>
<script type='text/javascript'>
//<![CDATA[
var geocoder = null;
function AfficherAdresse(addresse,lon_ad,la_ad,com_ad) {
if (geocoder) {
geocoder.getLatLng(
addresse,
function(point) {
if (!point) {
alert('Impossible de geolocaliser cette adresse'+addresse+com_ad+cp);
} else {
MaCarte.addControl(new GMapTypeControl());
MaCarte.addControl(new GOverviewMapControl());
MaCarte.addControl(new GLargeMapControl());
var marker = new GMarker(point, {draggable: true});
GEvent.addListener(marker, 'dragstart', function() {
MaCarte.closeInfoWindow();
});
GEvent.addListener(marker, 'dragend', function(point) {
AfficheGPS(marker);
});
MaCarte.addOverlay(marker);
AfficheGPS(marker);
MaCarte.setCenter(point, 15);
}
}
);
}
}
//]]>
</script>
<html>
<head>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAAD_snjZhIrbGNNRZrIdrTARSOQON08a6Pxfkjf9mWq3Ul" type="text/javascript"></script>
<meta http-equiv="Content-Language" content="fr,ca">
<link type="text/css" rel="stylesheet" href="../style.css">
</head>
<body onLoad="load() " onUnload="GUnload()" bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (gpsevasion_v3.psd) -->
<table width="802" height="86" border="0" align="center" cellpadding="0" cellspacing="0" id="Tableau_01">
<tr>
<td width="823" height="32" align="center" valign="top"> <div align="center">
<?php if (!isset($_POST['enregistrer'])){ // affichage fichier ?>
<form method="post" name="creation_poi" id="creation_poi" action="poi_proposition_visiteur_beta.php" onsubmit="AfficherAdresse(this.ad_ad.value,this.lon_ad.value,this.la_ad.value,what.value); return false">
<table width="100%" border="0">
<tr>
<td width="43%" align="center" valign="top"><div id="EmplacementDeMacarte" style="width: 350px; height: 360px"></div></td>
<td width="57%" height="345" align="center" valign="top"> <table width="100%" align="center">
<tr>
<td colspan="3" class="Tableau_titre"><div align="center"><? echo $tx_titre14 ?></div></td>
</tr>
<tr valign="baseline">
<td width="22%" align="right" nowrap class="Tableau_corps"><div align="right"><? echo "$tx_form3" ; ?></div></td>
<td colspan="2" class="Tableau_corps"> <input name="nom_ad" type="text" class="Boite" value="<? echo $_SESSION['nom_ad'] ?>" size="60">
</td>
</tr>
<tr valign="baseline">
<td height="24" colspan="3" align="right" nowrap class="Tableau_corps">
<div align="right">
<table width="102%" border="1" cellspacing="0" bordercolor="#FF0000" class="Tableau_corps">
<tr>
<td colspan="4"><div align="center" id="message"></div></td>
</tr>
</table>
<input name="position_lonla" type="submit" class="bouton" value="Localisation (long/lat)" onClick="what=this" >
</div></td>
</tr>
<tr>
<td colspan="3" class="Tableau_titre"><div align="center"><? echo $tx_titre15 ?></div></td>
</tr>
<tr valign="baseline">
<td align="right" nowrap class="Tableau_corps"><div align="right"><? echo "$tx_form4" ; ?></div></td>
<td width="55%" class="Tableau_corps"><input name="ad_ad" type="text" class="Boite" value="<? echo $_SESSION['ad_ad'] ?>" size="60"></td>
<td width="23%" align="center" valign="middle" class="Tableau_corps"><input name="position_ad" type="submit" class="bouton" value="Localisation (adresse)" onClick="what=this" ></td>
</tr>
<tr valign="baseline">
<td height="22" align="right" nowrap class="Tableau_corps"> </td>
<td colspan="2" class="Tableau_corps"><input name="enregistrer" type="submit" class="bouton" value="Proposer (adresse)" ></td>
</tr>
</table></td>
</tr>
</table>
<p>
</p>
<p>
<input type="hidden" name="MM_insert" value="form1">
<input type="hidden" name="m" value="1">
</p>
</form>
<p> </p>
<? } ?>
<?php if (isset($_POST['enregistrer'])){ // affichage fichier ?>
<table width="52%" border="0" align="center">
<tr>
<td class="Tableau_titre"><div align="center"><? echo $tx_titre16 ?></div></td>
</tr>
<tr>
<td height="64" class="Tableau_corps"> <div align="center">
<p class="right"> </p>
<p class="right"><a href="../poi_proposition_visiteur.php"><? echo "$tx_form16" ; ?></a></p>
<p class="right"><a href="../index.php"><? echo "$tx_form17" ; ?></a></p>
<p class="right"> </p>
</div></td>
</tr>
<tr>
<td class="Tableau_corps"><div align="center"></div></td>
</tr>
</table>
<p> </p>
<? } ?>
<p> </p>
</div></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html> |
J’ai une feuille avec une carte google , mon visiteur saisie une adresse ou une longitude et latitude.
En cliquant sur le bouton « vérifier adresse » ou « vérifier lon/la » il lance la fonction « AfficherAdresse » et positionne cette derniere sur la carte.
Je pense qu a ce niveau ça marche.
Une fois l’adresse correctement positionner je souhaite enregistrer dans ma base données les infos en cliquant sur le bouton « Proposer (adresse) » de facon classique en php
Et la ca ne marche pas je relance la fonction « AfficherAdresse » comme je ne connais pas javascript je dois louper des choses
Pouvez vous me donner un coup de main pour votre info voir la page de test
http://www.gps-evasion.com/_rep1/poi...iteur_beta.php
merci pour votre aide