Récupérer des données d'un formulaire
Posté : 02 avr. 2013, 14:13
Bonjour,
J'utilise le code ci-dessous pour afficher dans une page html des données provenant d'un formulaire SAGE :
Cependant, je voudrais pouvoir récupérer les données affichées à l'aide du langage PHP afin de les insérer dans une base de données de type MySQL avec phpMyAdmin.
Pour cela, j'ai rajouté :
et
Mais, mon problème est de savoir comment récupérer les données depuis mon fichier insert.php afin de les insérer dans la base de données. Je sais que pour récupérer les valeurs d'un input, on utilise
Merci,
J'utilise le code ci-dessous pour afficher dans une page html des données provenant d'un formulaire SAGE :
Code : Tout sélectionner
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-language" content="fr-FR" />
<meta http-equiv="Content-script-type" content="text/javascript" />
<meta http-equiv="Content-style-type" content="text/css" />
<meta name= "author" content="R&D Sage Metz"/>
<meta name="Identifier-URL" content="http://www.sage.fr" />
<meta name="Copyright" content="© 2009 - Sage France" />
<meta name= "Description" content="Troisième éditeur mondial de logiciels de gestion, Sage simplifie et automatise la gestion et les processus métier de 5,5 millions d’entreprises dans 70 pays à travers le monde." />
<title>Fiche Tiers</title>
<link href="tiers.css" rel="stylesheet" type="text/css" media="screen"/>
[javascript]<script type="text/javascript">
var lancer=0;
function init()
{
try
{
if(lancer==0)
{
lancer=1;
document.getElementById("ClientTitre").innerHTML=window.external.CompteT.Numero+" "+window.external.CompteT.Intitule;
document.getElementById("Intitule").innerHTML=window.external.CompteT.Intitule;
document.getElementById("SIRET").innerHTML= window.external.CompteT.SIRET;
//adresse du client
var tiretAdr1 = " ";
if(window.external.CompteT.Ville.length>0 && window.external.CompteT.CodePostal.length>0) tiretAdr1=" - ";
var tiretAdr2 = " ";
if(window.external.CompteT.Pays.length>0 && (window.external.CompteT.Ville.length>0 || window.external.CompteT.CodePostal.length>0)) tiretAdr2=" - ";
var codeAdresse = window.external.CompteT.Adresse
+"<br>"+window.external.CompteT.CodePostal+tiretAdr1
+window.external.CompteT.Ville+tiretAdr2
+window.external.CompteT.Pays;
document.getElementById("Adresse").innerHTML = codeAdresse;
//numéros de télphone et fax
var codeTelephone = window.external.CompteT.Telephone
document.getElementById("Phone").innerHTML = codeTelephone;
var codeTelecopie = window.external.CompteT.Telecopie;
document.getElementById("Fax").innerHTML = codeTelecopie;
//lien pour le lieu de livraison
var googleClientAdr = window.external.CompteT.Adresse
+", "+window.external.CompteT.CodePostal+", "
+window.external.CompteT.Ville+", "
+window.external.CompteT.Pays;
document.getElementById("Adresse").innerHTML = codeAdresse +"<br>"
+"<a href=\"http://maps.google.fr/maps?hl=fr&tab=wl&q='"+googleClientAdr+"'&hl=fr\">"
+"Localiser l'adresse dans Google Maps</a>";
document.getElementById("TabLivraison1").innerHTML="";
//lien pour le lieu de livraison
var googleClientLivr = window.external.ClientLieuLivr.Adresse
+", "+window.external.ClientLieuLivr.CodePostal+", "
+window.external.ClientLieuLivr.Ville+", "
+window.external.ClientLieuLivr.Pays;
//adresse de livraison
var tiretAdrLivr1 = " ";
if(window.external.ClientLieuLivr.Ville.length>0 && window.external.ClientLieuLivr.CodePostal.length>0) tiretAdrLivr1=" - ";
var tiretAdrLivr2 = " ";
if(window.external.ClientLieuLivr.Pays.length>0 && (window.external.ClientLieuLivr.Ville.length>0 || window.external.ClientLieuLivr.CodePostal.length>0)) tiretAdrLivr2=" - ";
var codeAdresseLivr = window.external.ClientLieuLivr.Adresse
+"<br>"+window.external.ClientLieuLivr.CodePostal+tiretAdrLivr1
+window.external.ClientLieuLivr.Ville+tiretAdrLivr2
+window.external.ClientLieuLivr.Pays;
document.getElementById("AdresseLivr").innerHTML = codeAdresseLivr + "<br>"
+"<a href=\"http://maps.google.fr/maps?hl=fr&tab=wl&q='"+googleClientLivr+"'&hl=fr\">"
+"Localiser l'adresse de livraison dans Google Maps</a>";
document.getElementById("TabLivraison1").innerHTML="Adresse de livraison";
}
}
catch (e)
{
}
}
</script>[/javascript]
</head>
<body>
<div id="bloc">
<h1>Fiche Tiers - <span id="ClientTitre"></span></h1>
<h2>Informations principales</h2>
<table width="100%">
<tr class="fondgris">
<td width="20%" align="right">Intitulé</td>
<td width="2%"> </td>
<td width="auto"><span id="Intitule"></span></td>
</tr>
<tr>
<td width="20%" align="right">N° SIRET</td>
<td width="2%"> </td>
<td width="auto"><span id="SIRET"></span></td>
</tr>
</table>
<h2>Joindre le tiers</h2>
<table width="100%">
<tr class="fondgris">
<td width="20%" align="right">Téléphone</td>
<td width="2%"> </td>
<td width="auto"><span id="Phone"></span></td>
</tr>
<tr>
<td width="20%" align="right">Télécopie</td>
<td width="2%"> </td>
<td width="auto"><span id="Fax"></span></td>
</tr>
</table>
<h2>Adresse du tiers</h2>
<table width="100%">
<tr class="fondgris">
<td width="20%" align="right">Adresse principale</td>
<td width="2%"> </td>
<td width="auto"><span id="Adresse"></span></td>
</tr>
<tr>
<td width="20%" align="right" id="TabLivraison1"></td>
<td width="2%"> </td>
<td width="auto"><span id="AdresseLivr"></span></td>
</tr>
</table>
</div>
<script type="text/javascript">init();</script>
</body>
</html>
Pour cela, j'ai rajouté :
Code : Tout sélectionner
<body>
[color=#FF0000]<form action="insert.php" method="post">[/color]
<div id="bloc">Code : Tout sélectionner
<br>
[color=#FF0000]<input type="submit" value="Envoyer">[/color]
</form>$_POST.Merci,