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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -