Re: send 1 dim array as hidden type via form
From: Paul Barfoot (Paul_at_theglobalfamily.fsworld.co.uk)
Date: 10/27/04
- Next message: Paul Barfoot: "Re: exec - Directory (including " ") and A LOTS of parameters"
- Previous message: David Collantes: "V-webmail and Richard Heyes"
- In reply to: hubert: "send 1 dim array as hidden type via form"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Paul Barfoot: "Re: exec - Directory (including " ") and A LOTS of parameters"
- Previous message: David Collantes: "V-webmail and Richard Heyes"
- In reply to: hubert: "send 1 dim array as hidden type via form"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|