Values von Checkboxen in Array speichern?
Ist es irgendwie möglich die values von aktivierten Checkboxen in ein Array zu speichern? Ich meine das so
Ich will dann folgendes Array haben:
Das ist zwar jetzt nur ein komischer Pseudocode, sollte aber verständlich sein
|
|
Quellcode |
1 2 3 |
Checkbox1: Value "ABC" checked Checbox2: Value "blabla" nicht checked Checkbox3: Value "123" checked |
Ich will dann folgendes Array haben:
|
|
Quellcode |
1 2 |
Array[0] = "ABC" Array[1] = "123" |
Das ist zwar jetzt nur ein komischer Pseudocode, sollte aber verständlich sein
In a world without leaders, who'd start all the wars?
The Offspring - Kill the president
The Offspring - Kill the president
Wie spreche ich denn dann das Array in der verarbeitenden PHP-datei an? $_POST[array[]] funktioniert nicht!
EDIT:
Das mit dem ansprechend funktioniert, allerdings wird kein Array erstellt...
Da bekomme ich nur einen Wert angezeigt!
EDIT:
Das mit dem ansprechend funktioniert, allerdings wird kein Array erstellt...
|
|
PHP-Quelltext |
1 2 |
echo "$check[0]";
echo "$check[1]";
|
Da bekomme ich nur einen Wert angezeigt!
In a world without leaders, who'd start all the wars?
The Offspring - Kill the president
The Offspring - Kill the president
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Filzo« (19. April 2004, 20:13)
hilft dir folgendes beispiel?
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 |
<form method="GET" action="test.php">
<input type="checkbox" name="c[0]" value="1">
<input type="checkbox" name="c[1]" value="2">
<input type="checkbox" name="c[2]" value="3">
<input type="submit" value="Abschicken"><input type="reset" value="Zurücksetzen"></p>
</form>
<?
echo "$c[0]<br>$c[1]<br>$c[2]";
?>
|
Zitat
Original von Filzo
Wie spreche ich denn dann das Array in der verarbeitenden PHP-datei an? $_POST[array[]] funktioniert nicht!
probiers doch mal hiermit:
$_POST['check'][0]
$_POST['check'][1]
jperl
Konfuzius [chinesischer Philosoph (551 - 479 v. Chr.)]
Das Entscheidende am Wissen ist, daß man es beherzigt und anwendet.
Das Entscheidende am Wissen ist, daß man es beherzigt und anwendet.
Zitat
Original von Thomas
hilft dir folgendes beispiel?
![]()
PHP-Quelltext
1 2 3 4 5 6 7 8 9<form method="GET" action="test.php"> <input type="checkbox" name="c[0]" value="1"> <input type="checkbox" name="c[1]" value="2"> <input type="checkbox" name="c[2]" value="3"> <input type="submit" value="Abschicken"><input type="reset" value="Zurücksetzen"></p> </form> <? echo "$c[0]<br>$c[1]<br>$c[2]"; ?>
So hab Ichs gemacht, und es funktioniert, danke Thomas!
In a world without leaders, who'd start all the wars?
The Offspring - Kill the president
The Offspring - Kill the president
Ähnliche Themen
-
PHP »-
if(!eregi... Blocken von leeren "arrays"...
(21. November 2006, 19:20)
-
PHP »-
Insert Kreiren lassen
(27. August 2006, 00:18)
-
PHP »-
Kurssystem: Habe ein Problem!!!
(20. Juni 2004, 13:58)
-
PHP »-
Arrays übergeben -> Problem!!!
(7. März 2004, 16:09)


