I get some values from a mySQL table into an array and then loop through the array, using an eval function to declare functions named after the values from the table. Inside these functions there is some code that creates a html form. Even though the form method is set to POST, the form input names and their values then appear in the URL like GET data.
<?php
$tables = $wpdb->get_results('select distinct form from forms', ARRAY_A);
for ($i=0;$i<count($tables);$i++) {
$a[] = $tables[$i][form];
}
foreach ($a as $functionname) {
if (!function_exists($functionname.'_list')) {
eval('function '.$functionname.'_list() {
global $wpdb;
$page = the_permalink();
echo "<form mehtod=\"POST\" action= \"".$page."\">";
// I loop through this a few times populating the form with more data from a DB table
echo "<div id = \"mySQLwp_form_row\">
<div id = \"mySQLwp_form_cell_left\">
<input type = \"checkbox\" name=\"fields\" value =\"".$fields[$i][label]."\">
</div>
<div id = \"mySQLwp_form_cell_right\">".$fields[$i][label]."</div> </div>";
echo "<br><input type=\"submit\" class=\"button-primary\" value=\"submit\" style = \"float:left\">
</form>";
}');
}
}
?>
This is what the URL looks like after pressing submit:
How can I get my eval() function to render a html form that posts instead of sending values in the URL?