I have reframed my Question:
I have a drop down box which is populated with a list of users.
<a href="#" class="Share<?=$r['Form']['id'];?>">Share</a>
<form action="/FormBuilder/index.php/forms/share/<?=$r['Form']['id']?>/<?=$userid?>" method="post" id="shareform<?=$r['Form']['id'];?>" class="shareform">
<p>Select the users with whom you want to share the Form</p>
<select id="userList" name="userList" multiple>
<?php foreach($users as $user){ ?>
<option value=<?=$user['User']['id'];?>><?=$user['User']['name'];?></option>
<?php }?>
</select>
<input type="submit" class="button" value="Share"/>
</form>
When I select the user and give submit, the Form's access field in the database is updated to "Shared".
Now I need to display the Form name that has been shared in the home page of the user whom I selected. This is the code for displaying the Form names that have been marked as "shared".
<?php if (!empty($formsShared)){
foreach ($formsShared as $shared):
echo $shared['Form']['name'];
endforeach;
}
else{
echo "There are no shared Forms !";
}?>
I need to get the selected values in the drop down box, so that I can have another for loop to display the Shared form only in the selected users home page. How do I get the option:value?