Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Bootstrap Example</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- </head>
- <body>
- <div class="container">
- <h2>Ajout Annonce</h2>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <div class="form-group">
- <label for="ville">Ville :</label>
- <select class="form-control" name="ville">
- <option value="Tunis">Tunis</option>
- <option value="Ariana">Ariana</option>
- <option value="Mannouba">Mannouba</option>
- <option value="Bizerte">Bizerte</option>
- <option value="Ben Arous">Ben Arous</option>
- </select>
- </div>
- <br>
- <div class="form-group">
- <label for="ville">Catégorie :</label>
- <label class="radio-inline">
- <input type="radio" name="categorie" value="auto">Automobile
- </label>
- <label class="radio-inline">
- <input type="radio" name="categorie" value="info">Informatique
- </label>
- <label class="radio-inline">
- <input type="radio" name="categorie" value="divers">Divers
- </label>
- </div>
- <div class="form-group">
- <label for="pwd">Titre:</label>
- <input type="text" class="form-control" name="titre" placeholder="Entrer titre">
- </div>
- <div class="form-group">
- <label for="comment">Contenu :</label>
- <textarea class="form-control" rows="5" name="contenu"></textarea>
- </div>
- <button type="submit" class="btn btn-default" name="btn_ajouter">Ajouter</button>
- </form>
- </div>
- <?php
- if(isset($_POST['btn_ajouter'])):
- include_once('../lib/annonce.class.php');
- $annonce=new annonce();
- extract($_POST);
- $annonce->ville=$ville;
- $annonce->categorie=$categorie;
- $annonce->titre=$titre;
- $annonce->contenu=$contenu;
- if($annonce->saveAnnonce()) echo 'Vous avez cliqué sur le bouton Ajouter';
- else echo 'Nope';
- endif;
- if(isset($_POST['btn_ajouter'])):
- include_once('../lib/annonce.class.php');
- $annonce=new annonce();
- $donnees=$annonce->getAnnonce();
- include_once('affiche_annonce.phtml');
- endif;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement