I want to make an array of various inputs. For example that my key is submit button, and I want that my array key would be a content of what my submit button needs, also my button is connected to text field.
My minimal code:
<?php
function element($submit){
if ($submit == "submit"){
$element = "<input type = $submit value = $submit /><INPUT type = $submit name = $submit value = $submit size=40 />";
}
$content = $element ;
return $content;
} // function element
function main($submit){
//print_r ($defaults);
foreach ($submit as $k=>$submit){
@$content .=element ($submit[$k]) . "<br />\n";
}
return "<form action = {$_SERVER['PHP_SELF']} method = POST>\n$content</form>";
}
$arr = array(
"submit" => array("submit", "OK","text", "question", ""),
);
$content .= main ($arr["submit"]);
print $content;
So the problem is I don't know how to put my key array values into HTML. Maybe I am doing it wrong? And is it bad practice to do like this?