Skip to content

Instantly share code, notes, and snippets.

@luizventurote
Created April 28, 2014 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizventurote/11379653 to your computer and use it in GitHub Desktop.
Save luizventurote/11379653 to your computer and use it in GitHub Desktop.
Auto fields in PHP.
<?php
$fields = array();
$fields[] = array(
"title" => "Nome",
"id" => "nome",
"type" => "text"
);
echo '<pre>';
print_r($fields);
echo '</pre>';
foreach ($fields as $key => $value) {
switch ($value['type']) {
case 'text':
echo '<div><label>'.$value['title'].'</label></div>';
echo '<div><input type="input"></div>';
break;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment