Forum Moderators: coopster

Message Too Old, No Replies

forms fields

         

TheSeoGuy

9:23 pm on Jul 27, 2004 (gmt 0)

10+ Year Member



If I am posting a form (POST) to a page called submit.php and in the form I have three fields all named the same.

<input type='text' id='name' value='bob'>
<input type='text' id='name' value='steve'>
<input type='text' id='name' value='jeff'>

Is there anything in php that will allow me to access all the data that is being passed to submit.php? For example, with asp, I believe it always took the three form fields as an array and therefore I was able to access them as follows:

request.form('name[0]') // bob
request.form('name[1]') // steve
request.form('name[2]') // jeff

If I do this with php, I only seem to be able to access the last value. In my example, jeff. Does php not support same name fields or am I missing something?

Thanks in advance.

coopster

9:32 pm on Jul 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



<input type='text' name='name[]' id='name' value='bob'> 
<input type='text' name='name[]' id='name' value='steve'>
<input type='text' name='name[]' id='name' value='jeff'>

I don't believe it will work without using the

name
attribute.

Resource:
PHP and HTML [php.net]

TheSeoGuy

9:50 pm on Jul 27, 2004 (gmt 0)

10+ Year Member



Coopster,

Yes! That is exactly what I'm trying to do! I got it to work.

Thank you.