Jump to content

[SOLVED] using foreach on deselected items


Canman2005

Recommended Posts

Hi all

 

I have a List/Menu which looks lik

 

<select name="users1[]" id="users1[]" multiple="multiple">
<option value="Dolor">Dolor</option>
<option value="Donec">Donec</option>
<option value="Integer">Integer</option>
<option value="Lacus">Lacus</option>
<option value="Leo">Leo</option
</select>

 

Is it possible to use

foreach($_POST['users1'] as $d)

on all items in the List/Menu, despite if they have been selected or not?

 

thanks in advance

 

ed

Link to comment
Share on other sites

firstly you mean this i guess then what please?

 


<select name="users1[]" id="users1[]" multiple="multiple">

<?php

$array=array("Dolor","Donec","Integer","Lacus","Leo");

foreach($array as $result){
echo"<option value='$result'>$result</option>";
}

?>
</select>

Link to comment
Share on other sites

try this a shot in the dark sorry.


Please hold down ctl button to selct more then one option please.

<br/><br/>

<select name="users1[]" id="users1[]" multiple="multiple">

<?php

$array=array("Dolor","Donec","Integer","Lacus","Leo");

foreach($array as $result){

echo"<option value='$result'>$result <br></option>";

}

?>
</select>

<br/><br/>

<input type="submit" name="submit" value="SEND!">

<?php

if(isset($_POST['submit'])){

foreach($users1 as $final_result){

	echo "You Selected: $final_result";
}


}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.