Why in a scalar? Why not pass the array through, i.e.

Foreach($test as $element)
{       echo("<input type='hidden' name='test[]' value='$element'>");

Tim Ward
Internet Chess www.chessish.com <http://www.chessish.com> 

        From:  Fabian Krumbholz - 2k web solutions
        Sent:  26 March 2002 09:31
        To:  PHP Mailingliste
        Subject:  [PHP] check form - save arrays in hidden fields?

        I have a contact form (form.php). I check the submitted data with
        same php file.

        If the e-mail adress is not valid I ask the user for a valid e-mail
        Therefor I create a new form with the field e-mail. The valid date
        adress, ...
        I put into hidden fields, so they don't get lost.

        This works fine until I integreate a file upload into my form.
        The file data stored in the $_FILES array get lost, when I submit
        form the second time (when the e-mail adress isn't valid).

        The same problem occours when I integrate a list box where it is
possible to
        choose more then one item:

        <select name="test[]" size="3" multiple>
          <option value="test1"> test1</option>
          <option value="test2"> test2</option>
          <option value="test3"> test3</option>

        Is there an easy way (in PHP 4.1.2) to store arrays like scalar
variables in
        hidden fields, without using a database or transforming the array
        into a string?


        Fabian Krumbholz

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to