|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I want to show the user a list of emails and the user must have the
ability to select which ones he wants. Multiple selections must be allowed. Any way I can do this? In PHP I want to do: foreach ($_POST['contacts'] as $contact) { // code... } But using Checkboxes doesn't work, I've tried putting them with the same name but all that appears is a string of the LAST selected checkbox :S. ? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
..oO(RageARC)
>I want to show the user a list of emails and the user must have the >ability to select which ones he wants. Multiple selections must be >allowed. Any way I can do this? In PHP I want to do: > >foreach ($_POST['contacts'] as $contact) { >// code... >} > >But using Checkboxes doesn't work, I've tried putting them with the >same name but all that appears is a string of the LAST selected >checkbox :S. ? Append [] to the names of the checkboxes, e.g. <input type="checkbox" name="foo[]" value="42"> Then $_POST['foo'] will be an array. Micha |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thanks Micha
Didn't know that! |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> But using Checkboxes doesn't work, I've tried putting them with the
> same name but all that appears is a string of the LAST selected > checkbox :S. ? I think you need check boxes here. html allow you to create many check connected with the same name. <input type="checkbox" name="options[1]" value="1" />Value 1 <input type="checkbox" name="options[2]" value="2" />Value 2 <input type="checkbox" name="options[4]" value="4" />Value 4 the submitted ones should appear as an $_POST array: [options] => Array ( [1] => 1 [4] => 4 ) |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Thanks guys, it really worked
. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
RageARC wrote:
> I want to show the user a list of emails and the user must have the > ability to select which ones he wants. Multiple selections must be > allowed. Any way I can do this? In PHP I want to do: > > foreach ($_POST['contacts'] as $contact) { > // code... > } > > But using Checkboxes doesn't work, I've tried putting them with the > same name but all that appears is a string of the LAST selected > checkbox :S. ? > Just remember - don't put the email address itself in your form - use id's, etc. instead. And validate your data. Spammers just love when you put the email address in a form field. And they'll love you, also, right up to the time your site gets shut down. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
![]() |
| Outils de la discussion | |
|
|