OrcusZ Pro AMD | .Net lover | Bonjour,
Je viens vers vous car ça fait deux jours que je cherche sur internet comment insérer correctement une date après réception de celle ci via un formulaire.
Je précise que je bosse pour que l'application fonctionne sous IE8 et FF16 et que je ne veux pas pour l'instant implémenter datepicker.
Voici ma fonction d'ajout dans ma base
Code :
- public function AddSat($satName,$satShortName,$SatLaunch,$SatIOAR,$SatWithMajorPB,$Client_idClient,$SatType_idSatType){
- $this->bdd = parent::Connexion();
-
- $reponse = $this->bdd->prepare("INSERT INTO `Satellite`(`SatName`, `SatShortName`, `SatLaunch`, `SatIOAR`, `SatWithMajorPB`, `Client_idClient`, `SatType_idSatType`) VALUES (:satName,:satShortName,:SatLaunch,:SatIOAR,:SatWithMajorPB,:Client_idClient,:SatType_idSatType)" );
-
- $reponse->execute(array('satName' => $satName,
- 'satShortName' => $satShortName,
- 'SatLaunch' => "'$SatLaunch'",
- 'SatIOAR' => "'$SatIOAR'",
- 'SatWithMajorPB' => $SatWithMajorPB,
- 'Client_idClient' => $Client_idClient,
- 'SatType_idSatType' => $SatType_idSatType,
-
- ));
-
- $this->bdd = null;
- }
|
voici mon formulaire
Code :
- <form method="post" action="test.php" >
-
- <label for='satClient'>Client :</label>
-
-
- <select name="satClient" id="satClient">
- <?php while($donnees = $reqClient->fetch()){ echo'<option value="'.$donnees['ClientName'].'">'.$donnees['ClientName'].'</option>'; } ?>
- </select>
- </br>
-
- <label for='satName'>Satellite Name :</label><input type="text" name="satName"/><br>
- <label for='satShortName'>Satellite Short Name :</label><input type="text" name="satShortName"/><br>
- <label for='satType'>Satellite Type :</label>
-
-
- <select name="satType" id="satType">
- <?php while($donnees = $reqType->fetch()){ echo'<option value="'.$donnees['type'].'">'.$donnees['type'].'</option>'; } ?>
- </select>
- </br>
-
- <label for='satDateLaunch'>Satellite Date Launch :</label><input size="6" type="date" name="satDateLaunch" placeholder="14/01/2001"/><br>
- <label for='satIOAR'>Satellite IOAR :</label><input size="6" type="date" name="satIOAR" placeholder="14/01/2001"/><br>
- <label for='majorProblems'>Major Problems :</label><input type="text" name="majorProblems"/><br>
- <input type="submit" value="Ajouter" class="login" />
- </form>
|
Je check si mes données sont bien reçu dans un controlleur et je reçois bien toutes mes données et j'utilise un pattern pour modifier la date au bon format.
La date est de ce format dans la variable : 20010114
Merci à vous ---------------
Made you your own sentence without believing that of the others...
|