Moin Forum!
Ich bin etwas am rätseln:
Ich übergebe aus einem Formular ein Select wie folgt:
<select name=\"contact_group_id[]\" size=\"4\" multiple>
Die Werte werden auch übergeben und kommen an.
$contact_group_ids = count($_REQUEST["contact_group_id"]).",";
$contact_group_ids .= $_REQUEST["contact_group_id"][0].",";
$contact_group_ids .= $_REQUEST["contact_group_id"][1].",";
$contact_group_ids .= $_REQUEST["contact_group_id"][2];
echo contact_group_ids ergibt dann 3,14,12,23.
Nutze ich aber, was ich ja eigentlich möchte, foreach wie folgt:
$contact_group_ids = $_REQUEST["contact_group_id"];
foreach($contact_group_ids as $this_group_ids) {
$this_group_ids .= $this_group_ids.",";
}
ergibt ein echo $this_group_ids die Ausgabe von 1414,
setzte ich danach noch ein unset($this_group_ids) ist die Ausgabe $this_group_ids wie ich es erwartete leer.
Wo liegt da bitte mein Fehler?
Ich bin etwas am rätseln:
Ich übergebe aus einem Formular ein Select wie folgt:
<select name=\"contact_group_id[]\" size=\"4\" multiple>
Die Werte werden auch übergeben und kommen an.
$contact_group_ids = count($_REQUEST["contact_group_id"]).",";
$contact_group_ids .= $_REQUEST["contact_group_id"][0].",";
$contact_group_ids .= $_REQUEST["contact_group_id"][1].",";
$contact_group_ids .= $_REQUEST["contact_group_id"][2];
echo contact_group_ids ergibt dann 3,14,12,23.
Nutze ich aber, was ich ja eigentlich möchte, foreach wie folgt:
$contact_group_ids = $_REQUEST["contact_group_id"];
foreach($contact_group_ids as $this_group_ids) {
$this_group_ids .= $this_group_ids.",";
}
ergibt ein echo $this_group_ids die Ausgabe von 1414,
setzte ich danach noch ein unset($this_group_ids) ist die Ausgabe $this_group_ids wie ich es erwartete leer.
Wo liegt da bitte mein Fehler?
Kommentar