Arrays übergeben

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Arrays übergeben

    Hi leute!

    Hat jemand einen Plan, wie ich Arrayvariablen einer anderen Seite übergeben kann? (z.B.: $Array= array(1,2,3); )

    Mit Post oder Get funktioniert das irgendwie nicht so ganz!!!!

    Grüße aus Bayern

  • #2
    Dann machst du das irgendwie nicht so richtigt

    Mit POST geht's auf jedenFall und mit GET bedingt.

    Wie versucht du's denn?
    Ich denke, also bin ich. - Einige sind trotzdem...

    Comment


    • #3
      Das müsste so funzen
      PHP Code:
      $_SESSION['mein_array'] = $array;
      var_dump($_SESSION['mein_array']; 
      Gruss

      tobi

      Manual
      Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

      [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
      Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

      Comment


      • #4
        ich mache das in etwa so:

        PHP Code:
        <?php
        echo '<form action="./naechste.php" method="POST">
                 <input type="hidden" name="ArrayVar" value="'
        .$ArrayVar.'">
                   </form>'
        ;
        ?>

        in der naechsten.php:

        <?php
        $ArrayVar 
        $_POST['ArrayVar']; 
        //??????????????????????????????????????????????????
        //In $ArrayVar[0] steht jetzt "A", in $ArrayVar[1] steht "r"
        //Im Endeffekt steht im $ArrayVar das Wort "Array"          
        //??????????????????????????????????????????????????
        ?>
        Last edited by ; 16-03-2006, 07:21.

        Comment


        • #5
          Tja dann steht wohl bereits im Form in der Var $ArrayVar etwas falsches drinn...
          Woher kommt diese Variable denn ? Was ist ihr Inhalt ? Kann es sein, dass diese Var ein mehr-dimenionales Array ist ?
          Wenn du einen Wert aus einen Input Field nimmst, dann ist der Datentyp, was auch immer du übergibst, immer ein String Du müsstest wenn schon alle Werte des Arrays als String im Form angeben
          PHP Code:
          //form.php
          $str implode(';',$ArrayVar); // geht so nur bei eindimensionalen Arrays
          //naechste.php
          $array explode(';',$_POST['ArrayVar']); 
          Gruss

          tobi
          Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

          [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
          Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

          Comment


          • #6
            ich hatte auch mal so ein problem und habs (glaubich) so gelöst:

            verpacken:
            PHP Code:
            $s serialize($array);
            $s base64_encode($s); 
            entpacken
            PHP Code:
            $s base64_decode($_REQUEST['array']);
            $sunserialize($s); 
            danach kannst du wieder aufs array zugreifen.
            mfg

            Comment


            • #7
              Danke Leute, ihr habt mir sehr geholfen!

              mfg
              ICH

              Comment

              Working...
              X