[thelist] Multiple form entries in PHP...

Steve Cook steve.cook at evitbe.com
Fri Nov 30 08:58:32 CST 2001


Dunno what the others have been smoking Mike, but you've been given some
slightly erroneous information here (unless I'm the one that's "out and
cycling" as they say in Sweden!).

Multiple form values are collected in an array - in this case

$form[0] ... $form[x] (where x is the number of records)

HOWEVER - (and it's a big one) the form names need to be...
name="form[]"

Here's a link explaining it:
http://www.php.net/manual/en/faq.html.php#AEN64388

This manual page is also useful:
http://www.php.net/manual/en/language.variables.external.php

I hope this helps - it seems esoteric, but it actually adds functionality
rather than taking it away if you think about it.


------------------------------------------
Steve Cook
web strategist
Evitbe AB
031-15 16 17   031-809 365   0703-13 26 31
steve.cook at evitbe.com       www.evitbe.com
------------------------------------------

> -----Original Message-----
> From: Mike King [mailto:mike.king at redroom.co.uk]
> Sent: den 30 november 2001 15:39
> To: thelist at lists.evolt.org
> Subject: RE: [thelist] Multiple form entries in PHP...
> 
> 
> At 03:49 30/11/01 -0800, you wrote:
> 
> >Since you're resetting the value of the same vatriable each time, it
> >makes sense that you're only able to see the value of the last one,
> >since that's the value of the variable at the time the rest of the
> >page loads.
> 
> Oh, very poor, in ASP it would give you a comma delimited list!
> 
> >If you want to pass multiple values, you'll either have to pass them
> >in as seperate variables (ie. ?field1=foo&field2=bar&field3=buh), or
> >use checkboxes in a from post instead of passing them in the 
> URL, as I
> >believe checkboxes are the only type of form field that 
> allow multiple
> >values to be submitted in asociation with the same form name.
> 
> Nope, these are checkboxes!
> 
> Cheers
> mk




More information about the thelist mailing list