a big ??? problem for me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dragosul
Forum Newbie
Posts: 1
Joined: Sun Jul 14, 2002 4:49 am

a big ??? problem for me

Post by dragosul »

I have a large <form> a really large form and i wish to make the php "lighter" if u can understand me :P

this is my problem :

..................................................................
i have many checkboxes like this one here with name and value
u can see then end of the name is the same with the value
and i wish to make a if something like
substr from name only the end part from the _ and check if is == with that value if so regist else not

<INPUT TYPE="CHECKBOX" NAME="region_lazio" VALUE="lazio">


can u understand me ?

i really need help the from is HUGE :< with many checkboxez like this and many values
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

When using checkboxes it is easiest to put the results into an array so:

Code: Select all

<INPUT TYPE="CHECKBOX" NAME="region&#1111;]" VALUE="lazio" />
For all the checkboxes that were previously name="region_something" put name="region[]", then you can loop through the resulting array to find out what was picked and to do different things accordingly. I'm not clear on what you need to do with the information though so I can't give you a good example of that. If you could explain in a bit more detail I'll try to help a bit more.

Mac
Post Reply