Multiple checkboxes send to array as php

If you have bad experience with making inputs named like cat1,cat2,cat3, there is a way to post to php custom amount of elements within the same field name. If you add [] to your field name, this value will be posted to PHP script as array of values, and you can traverse array easily: Category 1 Category 1 Category 1 // in php: foreach( $_POST['selectedcategories'] as $cat ) { echo "User selected $cat !
"; }
Of course, you can generate inputs by php from some source selecion model

Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP