|
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
I am running a PHp script to produce an HTML form with a SELECT MULTIPLE
feature. When I set method = GET and click on the SUBMIT button, the URL of the call page is: http://localhost/test/this.php?ports...ts=Po&ports=La which tells me that the four options i selected are indeed being sent. But when I try to get at the daata, I have a problem. A dump of the $_GET variable only gives me the last of the four values: array(1) { ["ports"]=> string(2) "La" } I added the following in my script: foreach ($_GET['ports'] as $p)echo $p . "<br>"; All I got was: Warning: Invalid argument supplied for foreach() in ... Can somebody me and tell me how to get at the full data sent by the form ? MS |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
Michel Simeon napisał(a):
> I am running a PHp script to produce an HTML form with a SELECT MULTIPLE > feature. > > When I set method = GET and click on the SUBMIT button, the URL of the > call page is: > http://localhost/test/this.php?ports...ts=Po&ports=La > > which tells me that the four options i selected are indeed being sent. > > But when I try to get at the daata, I have a problem. A dump of the > $_GET variable only gives me the last of the four values: > array(1) { ["ports"]=> string(2) "La" } > > I added the following in my script: > foreach ($_GET['ports'] as $p)echo $p . "<br>"; > > All I got was: Warning: Invalid argument supplied for foreach() in ... > > Can somebody me and tell me how to get at the full data sent by the > form ? > > MS The problem is that in input tags you should use name="foo[]" instead of name="foo" -- Wiktor Walc http://phpfreelancer.net |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
iktorn wrote:
> Michel Simeon napisał(a): >> I am running a PHp script to produce an HTML form with a SELECT >> MULTIPLE feature. >> >> When I set method = GET and click on the SUBMIT button, the URL of the >> call page is: >> http://localhost/test/this.php?ports...ts=Po&ports=La >> >> which tells me that the four options i selected are indeed being sent. >> >> But when I try to get at the daata, I have a problem. A dump of the >> $_GET variable only gives me the last of the four values: >> array(1) { ["ports"]=> string(2) "La" } >> >> I added the following in my script: >> foreach ($_GET['ports'] as $p)echo $p . "<br>"; >> >> All I got was: Warning: Invalid argument supplied for foreach() in ... >> >> Can somebody me and tell me how to get at the full data sent by >> the form ? >> >> MS > > The problem is that in input tags you should use name="foo[]" instead of > name="foo" > That was it, many thanks MS |
|
![]() |
| Outils de la discussion | |
|
|