C'est bon je voie les messages d'erreurs
Notice: Undefined index: pour chaque variable que j'utiliser.
le print_r : Array ( ) $libelle, $ville, $departement, $client, $chargedetude, $chargedaffaire, $type,$dateoffre, $fourniture, $soustraitance, $etude, $chantier, $mes, $mdb, $notification, $debut, $fin, $levee
( ! ) Fatal error: Call to undefined method PDOStatement::exec() in D:\wamp\www\Climatelec\affi.php on line 101
<?php include("connection.php") ?>
<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="css.css" />
<form method="post" action="affi.php?yo=yo">
<div class="datagrid"><table>
<thead><tr><th>Charge d'affaire</th></tr></thead>
<tr><td><select name="chargedaffaire">
<?php $select1 = $bdd->query('SELECT `Nom_prenom_personnel` FROM `personnel` WHERE `rang` = 2');
while($select_chargedaffaire = $select1->fetch(PDO::FETCH_OBJ)){
echo '<option value="'.$select_chargedaffaire->Nom_prenom_personnel,'">'.$select_chargedaffaire->Nom_prenom_personnel,'</option>';
} ?>
</select></td>
</tr>
</table></div>
<div class="datagrid"><table>
<thead><tr><th>Libelle</th><th>Ville</th><th>N° département</th><th>Client</th><th>Charge d'Etude</th><th>Type</th><th>Date (remise de l'offre)</th></tr></thead>
<tbody><tr><td><input type="text" size="40" name="libelle"></td><td><input type="text" name="ville"></td><td><input type="text"name="departement" size="10"></td><td><input type="text" name="client"></td><td><select align="center" valign="center" name="chargedetude">
<?php $select = $bdd->query('SELECT `Nom_prenom_personnel` FROM `personnel` WHERE `rang` = 1');
while($select_chargedetude = $select->fetch(PDO::FETCH_OBJ)){
echo '<option value="'.$select_chargedetude->Nom_prenom_personnel,'">'.$select_chargedetude->Nom_prenom_personnel,'</option>';
} ?>
</select>
</td><td><select name="type">
<option value="volvo">Appel d'Offre Public</option>
<option value="saab">Consultation Privée</option>
<option value="mercedes">Devis Prospectif</option>
<option value="audi">Etude de Faisabilité</option>
</select></td><td><input name="dateoffre"type="date" style="padding:5px; border:solid 1px black; color:steelblue; border-radius:5px;" /></td></tr>
</tbody>
</table></div>
<div class="datagrid"><table>
<thead><tr><th colspan="2" > Achat (HT €) </th><th colspan="2"> Main d'œuvre (h)</th><th> Marché de Base (HT €)</th></tr></thead>
<tbody><tr><td>Fourniture</td><td><input name="fourniture" type="text"> € </td><td> Etude </td><td><input name="etude" type="text"> h </td><td><input name="mdb" type="text"> € </td></tr>
<tr><td>Sous-traitance</td><td><input type="text"name="soustraitance"> € </td><td> Chantier </td><td> <input name="chantier" type="text"> h </td></tr>
<tr><td></td><td></td><td>Mise en Service </td><td> <input type="text" name="mes"> h </td>
</tbody></table> </div>
<div class="datagrid"><table>
<thead><tr><th colspan="4">Phasage des opérations</th></tr></thead>
<tbody><tr><td>Notification</td><td>Début des travaux</td> <td> Fin des travaux</td> <td>Levées des travaux </td></tr>
<tr> <td><input type="date" name="notification"> </td><td><input type="date"name="debut"> </td><td><input type="date" name="fin"> </td><td><input name="levee" type="date"> </td></tr>
</tbody></table></div>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><center><input type="button" value="Enregistrer"></center></td>
<td></td>
</tr>
</form>
</html>
<?php
if(isset($_GET['yo']) && $_GET['yo'] = "yo")
{
$libelle = $_POST['libelle'];
$ville = $_POST['ville'];
$departement = $_POST['departement'];
$client = $_POST['client'];
$chargedetude = $_POST['chargedetude'];
$chargedaffaire = $_POST['chargedaffaire'];
$type = $_POST['type'];
$dateoffre = $_POST['dateoffre'];
$fourniture = $_POST['fourniture'];
$soustraitance = $_POST['soustraitance'];
$etude = $_POST['etude'];
$chantier = $_POST['chantier'];
$mes = $_POST['mes'];
$notification = $_POST['notification'];
$debut = $_POST['debut'];
$fin = $_POST['fin'];
$mdb = $_POST['mdb'];
$levee = $_POST['levee'];
$format = "%d/%m/%Y";
print_r($_POST);
echo '$libelle, $ville, $departement, $client, $chargedetude, $chargedaffaire, $type,$dateoffre, $fourniture, $soustraitance, $etude, $chantier, $mes, $mdb, $notification, $debut, $fin, $levee ';
$add_affaire = $bdd->prepare('INSERT INTO `affaire`(`Avancement_affaire`, `Libelle_affaire`, `Lieu_affaire`, `Dept_affaire`, `ID_charge_affaire`, `ID_charge_etude`, `Client`, `Type_etude`,`Date_offre`, `Achat_fourniture_p`,`Achat_soustraitance_p`, `MOE_etude_p`, `MOE_chantier_p`, `MOE_mes_p`, `Devis_mdb_p`,`Phase_notification_p`, `Phase_debut_p`, `Phase_fin_p`, `Reserves_p`)
VALUES ("1" , :libelle , :ville , :departement , :chargedaffaire , :chargedetude , :client , :type , :dateoffre, :fourniture , :soustraitance, :etude , :chantier , :mes , :mdb , str_to_date( :notification , :format), str_to_date(:debut, :format), str_to_date(:fin,:format), str_to_date(:levee,:format))');
$ajout_affaire = $add_affaire->exec(array(
'libelle' => "$libelle",
'ville' => "$ville",
'departement' => "$departement",
'format' => "$format",
'client' => "$client",
'chargedaffaire' => "$chargedaffaire",
'chargedetude' => "$chargedetude",
'type' => "$type",
'dateoffre' => "$dateoffre",
'fourniture' => "$fourniture",
'soustraitance' => "$soustraitance",
'etude' => "$etude",
'chantier' => "$chantier",
'mes' => "$mes",
'notification' => "$notification",
'debut' => "$debut",
'fin' => "$fin",
'mdb' => "$mdb",
'levee' => "$levee"
));
execute() or die($add_affaire->errorInfo());
}