Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing array from html form to php 1

Status
Not open for further replies.

bezierstek

Programmer
Aug 30, 2007
43
FR
Hi all,

I want to pass a load of text fields to php in an array.

I thought that if I used
PHP:
 <input name="bullet[]" type="text"  size="60" />
            </label>
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
          </p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
</p>
          <p>
            <input name="bullet[]" type="text"  size="60" />
[/code]
and cycled through the array in php this would be fine, but I don't get any values.

I also tried giving each an array reference  (ie bullet[0] - bullet[9]), but that didn't work either.

Is there a way to do it?
 
How are you accessing the array?

It will be within the $_POST global array.

$_POST['bullet'] will be your array if the [] annotation method works - I've not used other than on checkboxes before.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Yep, that's exactly how I am accessing it, I am actually cycling through them using php. I've used it with checkboxe before no problem.

Thing is, if I do a count of the array it hows the correct amount of elements, they just don't seem to have any data.

Any suggestions for another way of doing this?
 
I am officially an idiot.

Just noticed a typo on the array name.

Sorry to have wasted your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top