1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
| <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Autoccasion</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />-->
</head>
<body>
<div class="container">
<br />
<br />
<br />
<h2 align="center">Recherche d'un véhicule</h2><br />
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Recherche</span>
<input type="text" name="search_text" id="search_text" placeholder="Recherche d'un véhicule" class="form-control" />
<div class="col-md-8">
<select name="mark" id="markt" class="form-control">
<option value="">select</option>
<?php
$mark_values = array(
'Volkswagen'=>'Volkswagen',
'Toyota'=>'Toyota',
'Audi'=>'Audi',
'BMW'=>'BMW',
'Ford'=>'Ford',
'Peugeot'=>'Peugeot',
'Citroen'=>'Citroen',
'Dacia'=>'Dacia',
'Kia'=>'Kia',
);
foreach($mark_values as $value => $display_text)
{
$selected = ($value == $this->input->post('mark')) ? ' selected="selected"' : "";
echo '<option value="'.$value.'" '.$selected.'>'.$display_text.'</option>';
}
?>
</select>
<span class="text-danger"><?php echo form_error('mark');?></span>
</div>
<div class="form-group">
<label for="type" class="col-md-4 control-label">Type</label>
<div class="col-md-8">
<select name="type" id="type" class="form-control">
<option value="">select</option>
<?php
$type_values = array(
'Citadine'=>'Citadine',
'Cabriolet'=>'Cabriolet',
'Berline'=>'Berline',
'Break'=>'Break',
'Utilitaire'=>'Utilitaire',
'Monospace'=>'Monospace',
'Autre'=>'Autre',
);
foreach($type_values as $value => $display_text)
{
$selected = ($value == $this->input->post('type')) ? ' selected="selected"' : "";
echo '<option value="'.$value.'" '.$selected.'>'.$display_text.'</option>';
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="color" class="col-md-4 control-label">Color</label>
<div class="col-md-8">
<select name="color" id="color" class="form-control">
<option value="">select</option>
<?php
$color_values = array(
'gris'=>'Gris',
'noir'=>'Noir',
'beige'=>'Beige',
'rouge'=>'Rouge',
'bleu'=>'Bleu',
'blanc'=>'Blanc',
'argent'=>'Argent',
'jaune'=>'Jaune',
'vert'=>'Vert',
'or'=>'Or',
'marron'=>'Marron',
'orange'=>'Orange',
'bronze'=>'Bronze',
'violet'=>'Violet',
);
foreach($color_values as $value => $display_text)
{
$selected = ($value == $this->input->post('color')) ? ' selected="selected"' : "";
echo '<option value="'.$value.'" '.$selected.'>'.$display_text.'</option>';
}
?>
</select>
</div>
</div>
<div class="col-md-8">
<select name="carburant" id="carburant" class="form-control">
<option value="">select</option>
<?php
$carburant_values = array(
'diesel'=>'Diesel',
'essence'=>'Essence',
'hybride'=>'Hybride',
'cng'=>'CNG',
'lpg'=>'LPG',
);
foreach($carburant_values as $value => $display_text)
{
$selected = ($value == $this->input->post('carburant')) ? ' selected="selected"' : "";
echo '<option value="'.$value.'" '.$selected.'>'.$display_text.'</option>';
}
?>
</select>
<span class="text-danger"><?php echo form_error('carburant');?></span>
</div>
</div>
</div>
</div>
<br />
<div id="result"></div>
</div>
<div style="clear:both"></div>
<br />
<br />
<br />
<br />
</body>
<script>
$(document).ready(function(){
load_data();
function load_data(query)
{
var carburant = $('#carburant option:selected').val();
var type = $('#type option:selected').val();
var color = $('#color option:selected').val();
var markt = $('#markt option:selected').val();
$.ajax({
url:"<?php echo base_url();?>index.php/moncontrolleur/fetch",
method:"POST",
data:{query:query, carburant:carburant, type:type, color:color, markt:markt},
success:function(data){
$('#result').html(data);
}
});
}
$('#search_text').keyup(function(){
var search = $(this).val();
if(search != '')
{
load_data(search);
}
else
{
load_data();
}
});
});
</script> |
Partager