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)
$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
Post a Comment