<form method="post" action="traitement.php">
<p class=tarifs>
<label for="société">Société</label> :<input size="40" type="text" name="Société" id="Société"/><br/>
<label for="Nom">Nom</label> :<input size="42" type="text" name="Nom" id="Nom"/><br/>
<label for="Prénom">Prénom</label> :<input size="39" type="text" name="Prénom" id="Prénom"/><br/>
<label for="adresse">Adresse</label> :<input size="39" type="text" name="Adresse" id="Adresse"/><br/>
<label for="code postal">Code postal</label> :<input size="35" type="text" name="Code postal" id="Code postal"/><br/>
<label for="ville">Ville</label> :<input size="43" type="text" name="Ville" id="Ville"/><br/>
<label for="email">email</label> :<input size="42" type="email" name="email" id="email"/><br/>
<label for="tel portable">Tel portable</label> :<input size="35" type="text" name="tel portable" id="tel portable"/><br/>
<label for="tel fixe">Tel Fixe</label> :<input size="39" type="text" name="tel fixe" id="tel fixe"/><br/>
<label for="adresse départ">Adresse de départ</label> :<input size="29" type="text" name="Adresse de départ" id="Adresse de départ"/><br/>
<label for="adresse destination">Adresse de destination</label> :<input size="24" type="text" name="adresse de destination" id="adresse de destination"/><br/>
<label for="heure de départ">Heure de départ souhaitée</label> :<input type="text" name="heure de départ" id="heure de départ"/><br/>
</p>
</form>
<form method="post" action="traitement.php">
<p class=tarifs>
<label for="Commentaires">Commentaires:</label><textarea name="Commentaires" id="Commentaires"></textarea>
</p>
<p>
<input type="submit" value="Envoyer" />
</p>
</form>foreach ($_POST as $key => $value){
$$key = $value;
}
}
si je me trompe pas avec cela tu déclares en une fois toutes tes variables stockées en $_POST directement MAIS attention ça prend TOUT ce qui est stocké dans le $_POST donc gaffe aux injections.
<?php
$Societe = $_POST['Societe'];
$Nom = $_POST['Nom'];
$Prenom = $_POST['Prenom'];
$Adresse = $_POST['Adresse'];
$Code_postal = $_POST['Code_postal'];
$Ville = $_POST['Ville'];
$email = $_POST['email'];
$Tel_portable = $_POST['Tel_portable'];
$Tel_Fixe = $_POST['Tel_Fixe'];
$Adresse_de_depart = $_POST['Adresse_de_depart'];
$Adresse_de_destination = $_POST['Adresse_de_destination'];
$Heure_de_depart_souhaitee = $_POST['Heure_de_depart_souhaitee'];
$Commentaires = $_POST['Commentaire'];
$content = $Societe."".$Nom;
$content = $Prenom."".$Adresse;
$content = $Code_postal."".$Ville;
$content = $email."".$Tel_portable;
$content = $Tel_fixe."".$Adresse_de_depart;
$content = $Adresse_de_destination."".$Heure_de_depart_souhaitee;
$content = $Commentaires;
mail("[email protected]", "SITE ".$name, "Envoyé par $content;= \r\n";)
?>
l'erreur après validation
$content = $Societe."".$Nom;
$content = $content . $Prenom."".$Adresse;
$content = $content . $Code_postal."".$Ville;
$content = $content . $email."".$Tel_portable;
$content = $content . $Tel_fixe."".$Adresse_de_depart;
$content = $content . $Adresse_de_destination."".$Heure_de_depart_souhaitee;
$content = $content . $Commentaires;
Car dans ton mail tu n'auras que le commentaire sinon.<?php
$Societe = $_POST['Societe'];
$Nom = $_POST['Nom'];
$Prenom = $_POST['Prenom'];
$Adresse = $_POST['Adresse'];
$Code_postal = $_POST['Code_postal'];
$Ville = $_POST['Ville'];
$email = $_POST['email'];
$Tel_portable = $_POST['Tel_portable'];
$Tel_Fixe = $_POST['Tel_Fixe'];
$Adresse_de_depart = $_POST['Adresse_de_depart'];
$Adresse_de_destination = $_POST['Adresse_de_destination'];
$Heure_de_depart_souhaitee = $_POST['Heure_de_depart_souhaitee'];
$Commentaires = $_POST['Commentaire'];
$content = $Societe."".$Nom;
$content = $content . $Prenom."".$Adresse;
$content = $content . $Code_postal."".$Ville;
$content = $content . $email."".$Tel_portable;
$content = $content . $Tel_fixe."".$Adresse_de_depart;
$content = $content . $Adresse_de_destination."".$Heure_de_depart_souhaitee;
$content = $content . $Commentaires;
mail("[email protected]", "SITE ".$name, "Envoyé par $content;= \r\n");
?>
Code : Tout sélectionner
( ! ) Notice: Undefined index: Societe in C:\wamp\www\tests\traitement.php on line 2
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Nom in C:\wamp\www\tests\traitement.php on line 3
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Prenom in C:\wamp\www\tests\traitement.php on line 4
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Adresse in C:\wamp\www\tests\traitement.php on line 5
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Code_postal in C:\wamp\www\tests\traitement.php on line 6
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Ville in C:\wamp\www\tests\traitement.php on line 7
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: email in C:\wamp\www\tests\traitement.php on line 8
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Tel_portable in C:\wamp\www\tests\traitement.php on line 9
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Tel_Fixe in C:\wamp\www\tests\traitement.php on line 10
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Adresse_de_depart in C:\wamp\www\tests\traitement.php on line 11
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Adresse_de_destination in C:\wamp\www\tests\traitement.php on line 12
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Heure_de_depart_souhaitee in C:\wamp\www\tests\traitement.php on line 13
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined index: Commentaire in C:\wamp\www\tests\traitement.php on line 14
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined variable: Tel_fixe in C:\wamp\www\tests\traitement.php on line 19
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Notice: Undefined variable: name in C:\wamp\www\tests\traitement.php on line 23
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
( ! ) Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\tests\traitement.php on line 23
Call Stack
#
Time
Memory
Function
Location
1 0.0040 145784 {main}( ) ..\traitement.php:0
2 0.0380 147296 mail ( ) ..\traitement.php:23<?PHP
print_r($_POST);
?>
2= Si tu retires les lignes 16 et 17 de ton formulaire tu constateras que tout fonctionne avec ma version de traitement, mais que Société (formulaire) est différent de Societe (ton taitement.php)