I'm trying to pull "building" types from a database and have it dynamically generate a form. The code work, the form displays, however, i've tried to re-use the code to display the "services" for another section of the form and it gets the following error:
Fatal error: Cannot redeclare get_checkbox_labels() (previously declared in /var/www/html/arch/architect_db_building_checkbox.php:21) in /var/www/html/arch/architect_db_services_checkbox.php on line 39
Here is my questions: how do i dump the value of the function so i can re-use it?
here is a sample of the code below:
/* get the checkbox labels */
$skills = get_checkbox_labels("building");
/* create the html code for a formatted set of
checkboxes */
$html_skills = make_checkbox_html($skills, 2, 400, "skills[]", $checked=array());
echo "Check Off Building Types";
echo "$html_skills";
function get_checkbox_labels($table_name) {
/* make an array */
$arr = array();
/* construct the query */
$query = "SELECT * FROM $table_name";
/* execute the query */
$qid = mysql_query($query);
/* each row in the result set will be packaged as
an object and put in an array */
while($row= mysql_fetch_object($qid)) {
array_push($arr, $row);
}
return $arr;
}