Re: send 1 dim array as hidden type via form

From: Paul Barfoot (Paul_at_theglobalfamily.fsworld.co.uk)
Date: 10/27/04


Date: Wed, 27 Oct 2004 20:14:42 +0100

Hi Hubert

I don't think HTML forms can have arrays as values. Try:

<form name="form1" method="get" action="http://www.blablabla">
          <input name="imageField" type="image" src="histo.gif"
width="300" height="20" border="0">
   <input type="hidden" name="redarray[]" value = "0" >
   <input type="hidden" name="redarray[]" value = "255" >
   <input type="hidden" name="redarray[]" value = "0" >
        </form>

This should send the 3 values through as an array called $redarray and you
then need to strip each part back out again in your receiving code.

I use a similar piece of code to create a multiple file upload page, sending
the filenames as an array.

-- 
Paul Barfoot
"hubert" <hubert_beaumont@binuscan.com> wrote in message 
news:e5401c32.0410220243.7e67e343@posting.google.com...
> Hi,
> I am willing to send an array via a form. For some reasons it doesn't
> work, is somebody can tell me why?
>
> Sending code as follow:
>
> $testarray = array_fill(0, 255, 0);
>
>
> <form name="form1" method="get" action="http://www.blablabla">
>          <input name="imageField" type="image" src="histo.gif"
> width="300" height="20" border="0">
>    <input type="hidden" name="redarray" value = "<? echo $testarray
> ?>" >
>        </form>
>
> Receiving page as follow:
>
> $RedHistogram = array_fill(0, 255, 0);
> $result = count($RedHistogram);
> print "Size 1: ";
> print $result;
> print "<br>";
>
>
> $RedHistogram = $_GET['redarray'];
> print $RedHistogram;
> print "<br>";
>
>
> $result = count($RedHistogram);
> print "Size 2: ";
> print "<br>";
> print $result;
>
> So size 1 returns:255
> Size 2 returns:1 


Relevant Pages

  • encoding nightmare
    ... posting xml documents as a byte array to an ASP.NET page on our web server. ... Sending code: ... Receiving code: ... The remote server returned an error: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Receiving xml problem
    ... posting xml documents as a byte array to an ASP.NET page on our web server. ... Sending code: ... Receiving code: ... The remote server returned an error: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Receiving xml as a byte array problem
    ... posting xml documents as a byte array to an ASP.NET page on our web server. ... Sending code: ... Receiving code: ... The remote server returned an error: ...
    (microsoft.public.dotnet.general)
  • Re: A different solution..
    ... > A few days ago I asked how I could define a dynamic array as a property ... gate methods and the receiving code retains complete control over ... since even code that would seem to replace the property object ...
    (comp.lang.pascal.delphi.misc)
  • Re: send 1 dim array as hidden type via form
    ... I came across a similar problem, I want to store the $_POST array as a ... HIDDEN field on a sheet. ... I had a look at the implode/explode functions the might just do the ... > then need to strip each part back out again in your receiving code. ...
    (php.general)