I am getting the values from a HTML Select like this.
Javascript:
$("#Check").submit(function ()
{
alert($('[name="SCADA[]"]').val());
return false;
});
The jquery alert shows the array with the selected values from the HTML Seletec.
HTML / PHP
<form id="Check" action="Update.php" method="post">
<select multiple="multiple" size="10" name="SCADA[]">
<?php
$wec = $conn->prepare("SELECT SCADA FROM tblwec WHERE SCADA <> '' GROUP BY SCADA ORDER BY SCADA ASC");
$wec -> execute();
while($row = $wec->fetch(PDO::FETCH_ASSOC)) {
echo '<option>'.$row['SCADA'].'</option>';}
?>
</select>
<br>
<button type="submit" class="btn btn-primary">Submit data</button>
</form>
I need to pass the values SCADA[] into the PHP Update.php! But When I do the $_POST method the variable is empty.
$SCADA = $_POST['SCADA[]'];
Any suggestions? Thank you
print_r($_POST['SCADA']);