I have a form with method post and i have html selection box which is displaying my options. my option value is 'id_service'. When click on the button, it posts the array to auth_insert.php . Here is my form below.
$rvar_service="SELECT id_s,nom_s FROM tablename WHERE company LIKE '%tous%' OR societe LIKE '%me%'";
$var_service = $conn->query($rvar_service);
<form action='filePost.php' method='POST' style='background-color:#FF6600;'>
<?php if($var_service->num_rows>0){ ?>
<fieldset>
<legend><h3>Services déjà Autorisés</h3></legend>
<select name='nservice[]' size='15'>
<?php while($var_service_row = $var_service->fetch_assoc()) {
echo "<option value=".$var_service_row['id_s'].">".$var_service_row['nom_s']."</option>" ?>
<?php } } ?>
</select>
<div style='text-align:right;'><input type='submit' value='Autoriser'></div>
</fieldset>
</form>
My post file is called auth_insert.php is below. In this file i have posted the variable which print my array. that array variable doesn't print it's elements. i don't where is the problem exist.
session_start();
$code_e=$_SESSION['ecoutant'];
$id_s = $_POST['nservice'];
print'<pre>';
print $code_e.'<br/>';
print $id_s;
print'<pre>';