PHP How do I read the form variables with empty square brackets in their name -


in php file when submit i'm able read following variables quite (see attached picture)

enter image description here

$mobile = $_request['mobile'];   $about = $_request['about'];   $comment = $_request['comment'];  

now question is.. how read "category[]" form value?

just read read normal variables.

$category = $_request['category'];  

unlike other variables return php array. can iterate on variable normal php array.

foreach($category $cat) {     echo $cat; } 

make sure check if request have value you're looking using isset(). otherwise above code might throw undefined indexed error.


Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

timer - Java TimerTask cancel -

android - How to read a column value in parse.com without accessing an object or a pointer -