The issue is i can only retrieve one value from the select dropdown even i have selected 2, have tried to look at similar question here,but none seems to work for me. Any thoughts? Thanks
if (isset($_POST['submit'])){
$smsorcall = $_POST['smsorcall'];
foreach($smsorcall AS $index => $smsorcall ) {
echo "$smsorcall";}
}
<form action="newpatient.php" method="post">
<p>Reminder Preference: *</p>
<select name="smsorcall[]" style="width: 250px" class="form-control" multiple>
<option value="SMS">SMS</option>
<option value="Call">Call</option>
<option value="Email">Email</option>
</select>
<button type="submit" name="submit">Submit</button>
</form>
My code
<?php ob_start();
session_start();
include('connect-db.php');
if (isset($_POST['submit']))
{
$patientid = $_POST['patientid'];
$smsorcall = $_POST['smsorcall'];
foreach($smsorcall AS $index => $smsorcall ) {
echo "$smsorcall";}
$_SESSION['smsorcall'] = $smsorcall;
In another html page, i echo the $_SESSION['smsorcall'] to display the result
</div>