<?php //Activation affichage des erreurs PHP error_reporting(E_ALL); ini_set('display-errors','on'); //connexion à la bdd require_once 'db.php'; //récupération PROPRE des variables AVANT de les utiliser //pour ça.. j'utilise l'écriture TERNAIRE avec un !EMPTY $chercher = !empty($_POST['chercher']) ? $_POST['chercher'] : NULL; $ident = !empty($_POST['ident']) ? $_POST['ident'] : NULL; $libstage = !empty($_POST['libstage']) ? $_POST['libstage'] : NULL; //traitement du SUBMIT if($chercher){ header("location: resrech.php?ident=".$ident); exit(); //toujours un exit après un header loction } //récupération des infos à afficher dans le select $sql = "select * from entreprise order by nom"; $query=mysqli_query($mysqli,$sql); //ensuite tu peux mettre ton html: ?> <html> <head> <meta charset='utf8'></meta> <title> Ton titre </title> </head> <body> <div class="modal fade" id="smallModal" tabindex="-1" role="dialog"> <div class="modal-dialog modal-sm" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="smallModalLabel">OFFRES DES STAGES</h4> </div> <form method="post" action=""> <div class="modal-body"> <input placeholder="libelle" type="text" id="form-control" class="form-control text" name="libstage" required="true"> <br> <br> <select name="ident" class="form-control show-tick" style="width:250px;height:43px" required="true"> <option selected="selected" value="0"> --Selectionner Entreprise-- </option> <?php while($row=mysqli_fetch_array($query, MYSQLI_ASSOC)){ echo '<option value="'.$row['id'].'">'.$row['nom'].'</option>'; } ?> </select> </div> <div class="modal-footer"> <button type="submit" name="chercher" class="btn btn-link waves-effect">chercher</button> <button type="button" class="btn btn-link waves-effect" data-dismiss="modal">annuler</button> </div> </form> </div> </div> </div> <script src="all/js/pages/ui/modals.js"></script> <!-- Dropzone Plugin Js --> <script src="all/plugins/dropzone/dropzone.js"></script> </body> </html>
<form method="post" action="resrech.php">
<!DOCTYPE HTML>
<html>
<head>
<title>STAGE | FRANCE</title>
<link rel="shortcut icon" type="image/x-icon" href="images/fr.png" />
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- start plugins -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- start slider -->
<link href="css/slider.css" rel="stylesheet" type="text/css" media="all" />
<!-- Dropzone Css -->
<link href="all/plugins/dropzone/dropzone.css" rel="stylesheet">
<script type="text/javascript" src="js/modernizr.custom.28468.js"></script>
<script type="text/javascript" src="js/jquery.cslider.js"></script>
<script type="text/javascript">
$(function() {
$('#da-slider').cslider({
autoplay : true,
bgincrement : 450
});
});
</script>
<!-- Owl Carousel Assets -->
<link href="css/owl.carousel.css" rel="stylesheet">
<script src="js/owl.carousel.js"></script>
<script>
$(document).ready(function() {
$("#owl-demo").owlCarousel({
items : 1,
lazyLoad : true,
autoPlay : true,
navigation : true,
navigationText : ["", ""],
rewindNav : false,
scrollPerPage : false,
pagination : false,
paginationNumbers : false,
});
});
</script>
<!-- //Owl Carousel Assets -->
<!--font-Awesome-->
<link rel="stylesheet" href="fonts/css/font-awesome.min.css">
<!--font-Awesome-->
</head>
<body>
<div class="header_bg">
<div class="container">
<div class="row header">
<img src="images/fr.png" style="margin-top:26px;margin-left:-370px" width="30" height="30">
<div class="logo navbar-left">
<h1 style="margin-left:60px"><a href="index.php" rel="nofollow noopener noreferrer" target="_blank"><span class="Style3"></span>STAGE POUR VOUS</a></h1>
</div>
<div class="h_search navbar-right" >
<button style="margin-left:190px;width:160px" class="btn bg-pink waves-effect" data-toggle="modal" data-target="#smallModal">RECHERCHE RAPIDE</button>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="container">
<div class="row h_menu">
<nav class="navbar navbar-default navbar-left" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="index.php" rel="nofollow noopener noreferrer" target="_blank">Accueil</a></li>
<li><a href="login.php" rel="nofollow noopener noreferrer" target="_blank">Espace Privee</a></li>
<li><a href="inscrit.php" rel="nofollow noopener noreferrer" target="_blank">Inscription</a></li>
<li><a href="contact.php" rel="nofollow noopener noreferrer" target="_blank">Contact</a></li>
</ul>
</div><!-- /.navbar-collapse -->
<!-- start soc_icons -->
</nav>
<div class="soc_icons navbar-right">
<ul class="list-unstyled text-center">
<li><a href="#" rel="nofollow noopener noreferrer" target="_blank"><i class="fa fa-twitter"></i></a></li>
<li><a href="#" rel="nofollow noopener noreferrer" target="_blank"><i class="fa fa-facebook"></i></a></li>
<li><a href="#" rel="nofollow noopener noreferrer" target="_blank"><i class="fa fa-youtube"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="main_bg"><!-- start main -->
</div><!-- end main -->
<br>
<!-- start main_btm -->
<div class="container">
<!----start-img-cursual---->
<div id="owl-demo" class="owl-carousel text-center">
<img src="images/a.jpg" width="950" height="450">
<img src="images/b.jpg" width="950" height="450">
<img src="images/c.png" width="950" height="450">
<img src="images/d.png" width="950" height="450">
</div>
<!----//End-img-cursual---->
</div>
<br><br>
<div class="footer_bg"><!-- start footer -->
<div class="container">
<div class="row footer">
<div class="copy text-center">
<p class="link"><span>© All rights reserved | Design by <a href=""> NADIA GHAZALI </a></span></p>
</div>
</div>
</div>
</div>
<div class="modal fade" id="smallModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="smallModalLabel">OFFRES DES STAGES</h4>
</div>
<form method="post" action="">
<div class="modal-body">
<input placeholder="libelle" type="text" id="form-control" class="form-control text" name="libstage" required="true">
<br> <br>
<select name="ident" class="form-control show-tick" style="width:250px;height:43px" required="true">
<option selected="selected" value="0"> --Selectionner Entreprise-- </option>
<?php
include('db.php');
$sql=mysqli_query($mysqli,"select * from entreprise order by nom");
while($row=mysqli_fetch_array($sql, MYSQLI_ASSOC))
{
echo '<option value="'.$row['id'].'">'.$row['nom'].'</option>';
}
?>
</select>
</div>
<div class="modal-footer">
<button type="submit" name="chercher" class="btn btn-link waves-effect">chercher</button>
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">annuler</button>
<?php
if(isset($_POST['chercher']))
{
$ident = $_POST['ident'];
$libstage = $_POST['libstage'];
header("location: resrech.php?ident=".$ident."");
}
?>
</div>
</form>
</div>
</div>
</div>
<script src="all/js/pages/ui/modals.js"></script>
<!-- Dropzone Plugin Js -->
<script src="all/plugins/dropzone/dropzone.js"></script>
</body>
</html>
<?php
//Activation affichage des erreurs PHP
error_reporting(E_ALL);
ini_set('display-errors','on');
//connexion à la bdd
require_once 'db.php';
//récupération PROPRE des variables AVANT de les utiliser
//pour ça.. j'utilise l'écriture TERNAIRE avec un !EMPTY
$chercher = !empty($_POST['chercher']) ? $_POST['chercher'] : NULL;
$ident = !empty($_POST['ident']) ? $_POST['ident'] : NULL;
$libstage = !empty($_POST['libstage']) ? $_POST['libstage'] : NULL;
//traitement du SUBMIT
if($chercher){
header("location: resrech.php?ident=".$ident);
exit(); //toujours un exit après un header loction
}
//récupération des infos à afficher dans le select
$sql = "select * from entreprise order by nom";
$query=mysqli_query($mysqli,$sql);
//ensuite tu peux mettre ton html:
?>
<!DOCTYPE HTML>
<html>
<head>
<title>STAGE | FRANCE</title>
<link rel="shortcut icon" type="image/x-icon" href="images/fr.png" />
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- start plugins -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- start slider -->
<link href="css/slider.css" rel="stylesheet" type="text/css" media="all" />
<!-- Dropzone Css -->
<link href="all/plugins/dropzone/dropzone.css" rel="stylesheet">
<script type="text/javascript" src="js/modernizr.custom.28468.js"></script>
<script type="text/javascript" src="js/jquery.cslider.js"></script>
<script type="text/javascript">
$(function() {
$('#da-slider').cslider({
autoplay : true,
bgincrement : 450
});
});
</script>
<!-- Owl Carousel Assets -->
<link href="css/owl.carousel.css" rel="stylesheet">
<script src="js/owl.carousel.js"></script>
<script>
$(document).ready(function() {
$("#owl-demo").owlCarousel({
items : 1,
lazyLoad : true,
autoPlay : true,
navigation : true,
navigationText : ["", ""],
rewindNav : false,
scrollPerPage : false,
pagination : false,
paginationNumbers : false,
});
});
</script>
<!-- //Owl Carousel Assets -->
<!--font-Awesome-->
<link rel="stylesheet" href="fonts/css/font-awesome.min.css">
<!--font-Awesome-->
</head>
<body>
<div class="header_bg">
<div class="container">
<div class="row header">
<img src="images/fr.png" style="margin-top:26px;margin-left:-370px" width="30" height="30">
<div class="logo navbar-left">
<h1 style="margin-left:60px"><a href="index.php" rel="nofollow noopener noreferrer" target="_blank"><span class="Style3"></span>STAGE POUR VOUS</a></h1>
</div>
<div class="h_search navbar-right" >
<button style="margin-left:190px;width:160px" class="btn bg-pink waves-effect" data-toggle="modal" data-target="#smallModal">RECHERCHE RAPIDE</button>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="container">
<div class="row h_menu">
<nav class="navbar navbar-default navbar-left" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="index.php" rel="nofollow noopener noreferrer" target="_blank">Accueil</a></li>
<li><a href="login.php" rel="nofollow noopener noreferrer" target="_blank">Espace Privee</a></li>
<li><a href="inscrit.php" rel="nofollow noopener noreferrer" target="_blank">Inscription</a></li>
<li><a href="contact.php" rel="nofollow noopener noreferrer" target="_blank">Contact</a></li>
</ul>
</div><!-- /.navbar-collapse -->
<!-- start soc_icons -->
</nav>
<div class="soc_icons navbar-right">
<ul class="list-unstyled text-center">
<li><a href="#" rel="nofollow noopener noreferrer" target="_blank"><i class="fa fa-twitter"></i></a></li>
<li><a href="#" rel="nofollow noopener noreferrer" target="_blank"><i class="fa fa-facebook"></i></a></li>
<li><a href="#" rel="nofollow noopener noreferrer" target="_blank"><i class="fa fa-youtube"></i></a></li>
</ul>
</div>
</div>
</div>
<div class="main_bg"><!-- start main -->
</div><!-- end main -->
<br>
<!-- start main_btm -->
<div class="container">
<!----start-img-cursual---->
<div id="owl-demo" class="owl-carousel text-center">
<img src="images/a.jpg" width="950" height="450">
<img src="images/b.jpg" width="950" height="450">
<img src="images/c.png" width="950" height="450">
<img src="images/d.png" width="950" height="450">
</div>
<!----//End-img-cursual---->
</div>
<br><br>
<div class="footer_bg"><!-- start footer -->
<div class="container">
<div class="row footer">
<div class="copy text-center">
<p class="link"><span>© All rights reserved | Design by <a href=""> NADIA GHAZALI </a></span></p>
</div>
</div>
</div>
</div>
<div class="modal fade" id="smallModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="smallModalLabel">OFFRES DES STAGES</h4>
</div>
<form method="post" action="">
<div class="modal-body">
<input placeholder="libelle" type="text" id="form-control" class="form-control text" name="libstage" required="true">
<br> <br>
<select name="ident" class="form-control show-tick" style="width:250px;height:43px" required="true">
<option selected="selected" value="0"> --Selectionner Entreprise-- </option>
<?php
while($row=mysqli_fetch_array($query, MYSQLI_ASSOC)){
echo '<option value="'.$row['id'].'">'.$row['nom'].'</option>';
}
?>
</select>
</div>
<div class="modal-footer">
<button type="submit" name="chercher" class="btn btn-link waves-effect">chercher</button>
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">annuler</button>
</div>
</form>
</div>
</div>
</div>
<script src="all/js/pages/ui/modals.js"></script>
<!-- Dropzone Plugin Js -->
<script src="all/plugins/dropzone/dropzone.js"></script>
</body>
</html>
$chercher = isset($_POST['chercher']) ? true : NULL;
//traitement du SUBMIT if($ident){ header("location: resrech.php?ident=".$ident); exit(); //toujours un exit après un header loction }
8 mai 2017 à 10:45
merci
voila mon page resrech.php , je le fais plus tot pour afficher le résultat