{"id":365,"date":"2012-09-25T22:29:49","date_gmt":"2012-09-25T22:29:49","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=365"},"modified":"2012-09-25T22:29:49","modified_gmt":"2012-09-25T22:29:49","slug":"how-to-get-values-of-multiple-select-in-php","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2012\/09\/25\/how-to-get-values-of-multiple-select-in-php\/","title":{"rendered":"How To Get Values Of Multiple Select In PHP"},"content":{"rendered":"<p>As we all know Multiple Select in HTML is a Select box where we can choose multiple values.<\/p>\n<p>While define multiple select by adding multiple=&#8221;multiple&#8221; like the example below &#8211;<\/p>\n<pre class=\"brush:html;\">\n<select name=\"sel\" multiple=\"multiple\">\n     <option value='1'>One<\/option>\n     <option value='2'>Two<\/option>\n     <option value='3'>Three<\/option>\n<\/select>\n<\/pre>\n<p>But when we will submit data, even after choosing multiple values, $_POST will show only one entry. To get all the values we need to <strong>change the name from sel to sel[]<\/strong>. This will result in showing all the chosen values in $_POST like below &#8211;<\/p>\n<p>[sel] => Array<br \/>\n     (<br \/>\n        [0] => 1<br \/>\n        [1] => 2<br \/>\n     )<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As we all know Multiple Select in HTML is a Select box where we can choose multiple values. While define multiple select by adding multiple=&#8221;multiple&#8221; like the example below &#8211; One Two Three But when we will submit data, even after choosing multiple values, $_POST will show only one entry. To get all the values&hellip; <a class=\"more-link\" href=\"https:\/\/codeboss.in\/web-funda\/2012\/09\/25\/how-to-get-values-of-multiple-select-in-php\/\">Continue reading <span class=\"screen-reader-text\">How To Get Values Of Multiple Select In PHP<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[45,48,55,57,60],"class_list":["post-365","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-form","tag-html","tag-multiple-select","tag-php","tag-post","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=365"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/365\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}