mahalleday Posted May 30, 2010 Share Posted May 30, 2010 Does anyone have or know of an easy to use php form generation class that can accept data pulled from mysql database tables? I have started to build my own but I because my oo php skills are somewhat limited I know there has to be some one out there who has already done this are far better than anything I have written. Why re-invent the wheel right. Here is the method I wrote to pull an associative array from a database and create a select list. //create select box from database function formSelectBoxDB($inputs, $sql, $val, $key) { $query = mysql_query($sql); $select = '<select'; $select .= ' name="'.$inputs['name']; $select .= '" id="'.$inputs['id']; $select .= '" class="'.$inputs['class'].'">'; $select .= '<option value="">Select '.$inputs['id'].'</option>'; while($rows = mysql_fetch_array($query, MYSQL_ASSOC)) { $select .= '<option'; $select .= ' value="'.$rows[$key].'">'; $select .= $rows[$val]; $select .= '</option>'; $i++; } $select .= '</select>'; return $select; } Link to comment https://forums.phpfreaks.com/topic/203387-php-form-class/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.