Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

34 lignes
1.3KB

  1. <?php
  2. session_start();
  3. include 'include/header.php';
  4. $pdoStat = $mysql->prepare('INSERT INTO products VALUES (NULL, :nom, :qualite, :prix, :prixlivr, :pays, :description, :iduser, :mail)');
  5. $query = $mysql->prepare("SELECT login FROM users WHERE idusers = :userid");
  6. $query->bindValue(':userid', $_SESSION['id']);
  7. $query->execute();
  8. $useremail = $query->fetch(PDO::FETCH_ASSOC);
  9. $pdoStat->bindValue(':nom', $_POST['name'], PDO::PARAM_STR);
  10. $pdoStat->bindValue(':qualite', $_POST['quality'], PDO::PARAM_STR);
  11. $pdoStat->bindValue(':prix', $_POST['price'], PDO::PARAM_STR);
  12. $pdoStat->bindValue(':prixlivr', $_POST['deliveryprice'], PDO::PARAM_STR);
  13. $pdoStat->bindValue(':pays', $_POST['country'], PDO::PARAM_STR);
  14. $pdoStat->bindValue(':description', $_POST['content'], PDO::PARAM_STR);
  15. $pdoStat->bindValue(':iduser', $_SESSION['id'], PDO::PARAM_STR);
  16. $pdoStat->bindValue(':mail', $useremail['login'], PDO::PARAM_STR);
  17. $insertIsOk = $pdoStat->execute();
  18. if ($insertIsOk) {
  19. $message = 'Votre annonce a été prises en compte<br \><br \><a href="homepage.php">Page d\'accueil</a>';
  20. } else {
  21. $message = 'Votre demande n\'a pu etre effectué essayés plus tard <br \><br \><a href="homepage.php">Page d\'accueil</a>';
  22. }
  23. ?>
  24. <div class="message">
  25. <?php echo $message ?>
  26. </div>