symfony - get Input values dynamically in php -
i devolping web application using symfony framework. have problem in forms. here code:
$value = array(); foreach ($myarray $value) { $fieldnameappend ='<input type="radio" name="'.$value.'cleaning'.$id.'" value="'.$value.'cleaning'.$id.'" id="'.$value.'cleaning'.$id.'" class="inputfields">'.$value.''; } print_r($fieldnameappend);
in loop got data in allvalues variable.but when access outside loop got 1 value.
please help
its because u keep overwriting $fieldnameappend.
you can try way put inputs in same string (notice .=)
fieldnameappend = ''; foreach ($myarray $value) { $fieldnameappend .='<input type="radio" name="'.$value.'cleaning'.$id.'" value="'.$value.'cleaning'.$id.'" id="'.$value.'cleaning'.$id.'" class="inputfields">'.$value.''; } echo $fieldnameappend;
or make array:
fieldnameappend = array(); foreach ($myarray $value) { $fieldnameappend[] ='<input type="radio" name="'.$value.'cleaning'.$id.'" value="'.$value.'cleaning'.$id.'" id="'.$value.'cleaning'.$id.'" class="inputfields">'.$value.''; } print_r($fieldnameappend);
Comments
Post a Comment