php - retrieve values from an array -


Hello Coder I have There is a database in the CCV format. To recover data, I use the csv parser from where I got the results in the array ([fieldset_name] => personal details [field_name] = & gt; applicant_name [field_label] = & gt; your name [field_type] = & Gt; Text [css_classes] = & gt;

  [middleline] => 4 [maximal] => 10 [default_value] = & gt; [help_text] = & Gt;) Array ([field = 1]] = & gt; personal details [field_name] = & gt; applicant_pad [field_label] = & gt; [[field_type] = & gt; text I [css_classes] = & gt; Required [minlength] => 4 [maxlength] => 10 [default_value] => [help_text] = & gt;)   

I now have an html form of this array

  & lt ;? To create a php foreach ($ form_field $ key = & gt; $ v1) {$ fieldset_name = $ v1} ['fieldset_name']; $ Field_name = $ v1 ['field_name']; $ Field_labil = $ v1 ['field_label']; $ Field_type = $ v1 ['field_type']; $ Css_classes = $ v1 ['css_classes']; $ Minlength = $ v1 ['Meanline']; $ Max length = $ v1 ['max length']; $ Default_value = $ v1 ['default_value']; & Lt; For label "& lt;? Php echo $ field_name ;; & gt; & Gt; & Lt; / Labels & gt; & Lt ;? Php echo $ field_label; ? & Gt; & Lt; Input type = "& lt ;? php echo $ field_type ;? & gt;" Id = "& lt ;? php echo $ css_classes ;? & gt;" /> & Lt ;? Php}? & Gt;   

From where "applicant_name" & gt; & Lt; / Label & gt; Your name & lt;

  for input type = "text" & lt; The result is labeled as "Id =" Required "/> & lt;" City "& gt; & lt; / Labels & gt; City & lt; Input Type =" Articles "id =" Required "/>   

Now I want to set both the values. For the first time I

   Name & lt; / legend & gt; & lt; label for "applicant_name" & gt; & lt; / label & gt; your name & lt; input type = "text" id = "required" /> & "City"> gt; City & lt; Input Type = "Articles" id = "Required" for the label & lt; Address & gt; Address & lt; / Story & gt; />   

Please tell me how this project is in the loop or if..seek status as such I have such a large form so I can not set the value manually.

id should be a unique value of preoperty because it is the same as

you They write "name" and "city" in their HTML code, but they can not be generated from your array.

The closest you can get is the results you want:

  foreach ($ form_field as $ f) {printf ('& lt; label = "% s" & gt; ;% S & lt; / label & gt; Input type = "text" class = "% s" name = "% s" value = "% s" />, $ f ['field_name' $ F ['field_label'], $ f ['css_classes'], $ f ['field_name'], $ f ['default_value']);}   

whatsoever Will produce:

  = "Applicant_name" & gt; Your name & lt; / Label & gt; & Lt; Label for input type = "text" class = "expected" name = "applicant_name" value = "" /> and ; ; Advertising costume and lieutenant; / Labels & gt; & Lt; Input type = "text" class = "required" name = "applicant_name" value = "" />    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -