NYCPHP Meetup

NYPHP.org

[nycphp-talk] Getting array in $_POST

Jeff Siegel jsiegel1 at optonline.net
Sat Feb 28 07:37:00 EST 2004


You're quite welcome.

Jeff
---------

leam wrote:

> That did it, thanks!
> 
> leam
> 
> Jeff Siegel wrote:
> 
>> Doing it this way you've got the problem, no doubt, where the Post var 
>> "Skill" is an array that starts with zero and has no relation to the 
>> skill itself.
>>
>>  > echo "<input name=\"Skill[]\" type=\"checkbox\"
>>  > value=\"$skill_data[skillID] \" \n ";
>>
>> However, nothing stops you from altering the "index" of the Skill 
>> array...so...instead of leaving it as <input name=\"Skill[]\"
>> you could do something along the lines of
>> <input name=\"Skill[$skillID]\"
>>
>> For an obviously different programming project, I needed check box 
>> corresponding to different car models. Look at the item below. You'll 
>> see that the index of the model_array is identical to the value. 
>> So...if the user clicks on the checkbox...I know that they have 
>> selected the model 3.2CL (an Integra, btw).
>> <input name="model_array[3.2CL]" type="checkbox" value="3.2CL">3.2CL
>>
>> Jeff
>>
>>
>> leam wrote:
>>
>>> Okay, I'll try to make this understandable before I fall asleep. I'm 
>>> setting a bunch of check boxes where each is a member of an array. So 
>>> the first line is:
>>>
>>> echo "<input name=\"Skill[]\" type=\"checkbox\" 
>>> value=\"$skill_data[skillID] \" \n ";
>>>
>>> $skill_data[skillID] was previously pulled from the database and is a 
>>> unique identifier for each skill. Each checkbox has the skill name 
>>> beside it so the user can check what skills they have and then submit 
>>> the form.
> 
> 
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 




More information about the talk mailing list